[FFmpeg-devel] [PATCH 1/3] avcodec/mpeg4videodec: Fix nonsense warning
Michael Niedermayer
michael at niedermayer.cc
Mon Feb 4 20:56:19 EET 2019
On Sat, Feb 02, 2019 at 08:34:10PM +0100, Andreas Rheinhardt wrote:
> Since db772308941a2a338c7809f90d347219a6a93074 parsing of
> mpeg4-extradata lead to a "Failed to parse extradata" warning, because
> ff_mpeg4_decode_picture_header returns AVERROR_INVALIDDATA in case that
> no VOP was found. This patch changes the return value back to -1 in case
> no error occured and no VOP was found.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at googlemail.com>
> ---
> libavcodec/mpeg4videodec.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
> index f44ee76bd4..9d820c2d71 100644
> --- a/libavcodec/mpeg4videodec.c
> +++ b/libavcodec/mpeg4videodec.c
> @@ -3202,7 +3202,8 @@ static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
>
> /**
> * Decode MPEG-4 headers.
> - * @return <0 if no VOP found (or a damaged one)
> + * @return -1 if no error occured, but no VOP was found
> + * <0 if no VOP found (or a damaged one)
> * FRAME_SKIPPED if a not coded VOP is found
> * 0 if a VOP is found
> */
> @@ -3235,6 +3236,8 @@ int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb)
> (ctx->divx_version >= 0 || ctx->xvid_build >= 0) || s->codec_tag == AV_RL32("QMP4")) {
> av_log(s->avctx, AV_LOG_VERBOSE, "frame skip %d\n", gb->size_in_bits);
> return FRAME_SKIPPED; // divx bug
> + } else if (get_bits_count(gb) == gb->size_in_bits) {
> + return -1; // ordinary return value for parsing of extradata
There is no gurantee that this condition is only true within extradata
also -1 is not an ideal code because it can overlap with some
AVERROR(E*)
Its probably cleaner to just pass a flag as argument that indicates if
the code is parsing a frame or a global header.
Thanks
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
There will always be a question for which you do not know the correct answer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190204/21f1ffcd/attachment.sig>
More information about the ffmpeg-devel
mailing list