[FFmpeg-devel] [PATCH] mpeg12dec: don't assert on unknown chroma format

Michael Niedermayer michaelni at gmx.at
Wed Sep 30 14:10:21 CEST 2015


On Wed, Sep 30, 2015 at 12:42:59PM +0200, Hendrik Leppkes wrote:
> The chroma format can be still unset in postinit when a badly cut stream
> starts with a slice instead of a sequence header. This is a common
> occurance when feeding avcodec from a Live TV stream.
> ---
>  libavcodec/mpeg12dec.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> index 5d916d1..b3c2c45 100644
> --- a/libavcodec/mpeg12dec.c
> +++ b/libavcodec/mpeg12dec.c
> @@ -1389,7 +1389,6 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
>              case 1: avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; break;
>              case 2:
>              case 3: avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; break;
> -            default: av_assert0(0);
>              }
>          } // MPEG-2

This assert double checks that the context init which uses
width/height/chroma format is done after the chroma format and w/h has
been read from the headers
if this is reached without the headers being read then the code is
buggy and removing the assert will not fix that bug

also if there is no sequence header how is width/height set ?
theres a check for width/height before mpeg_decode_postinit is called

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150930/5eebbbb2/attachment.sig>


More information about the ffmpeg-devel mailing list