[FFmpeg-devel] [PATCH] lavc/qsvenc: replace assert0 with an error return when pict_type is uninitialized

Li, Zhong zhong.li at intel.com
Wed Dec 5 07:37:57 EET 2018


> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf
> Of Linjie Fu
> Sent: Monday, December 3, 2018 4:34 PM
> To: ffmpeg-devel at ffmpeg.org
> Cc: Fu, Linjie <linjie.fu at intel.com>
> Subject: [FFmpeg-devel] [PATCH] lavc/qsvenc: replace assert0 with an error
> return when pict_type is uninitialized
> 
> pict_type may be uninitialized, and assert on a value coming from an
> external library is not proper.
> 
> Return invalid data error in function ff_qsv_encode to avoid using
> uninitialized value.
> 
> Signed-off-by: Linjie Fu <linjie.fu at intel.com>
> ---
>  libavcodec/qsvenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index
> 7f4592f878..891253be76 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -1338,7 +1338,7 @@ int ff_qsv_encode(AVCodecContext *avctx,
> QSVEncContext *q,
>          else if (bs->FrameType & MFX_FRAMETYPE_B || bs->FrameType
> & MFX_FRAMETYPE_xB)
>              pict_type = AV_PICTURE_TYPE_B;
>          else
> -            av_assert0(!"Uninitialized pict_type!");
> +            return AVERROR_INVALIDDATA;

Thus will be still a broken issue of ticket # 7593.
As comment in the ticket, I prefer to set the picture type to be AV_PICTURE_TYPE_NONE when MSDK return an unknown frame type, 
And also give a warning log message. 

BTW, please give a short and brief subject. There is a guideline about how to write commit message can be a reference: https://chris.beams.io/posts/git-commit/ 


More information about the ffmpeg-devel mailing list