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.rheinha...@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.

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to