diff mbox

[FFmpeg-devel] avcodec/qsvenc: add default initiaize for pict_type

Message ID 20181105094108.1097-1-linjie.fu@intel.com
State New
Headers show

Commit Message

Fu, Linjie Nov. 5, 2018, 9:41 a.m. UTC
add default initiaize for pict_type in function ff_qsv_encode
to avoid using uninitialized value:

FF_DISABLE_DEPRECATION_WARNINGS
        avctx->coded_frame->pict_type = pict_type;
FF_ENABLE_DEPRECATION_WARNINGS

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
---
 libavcodec/qsvenc.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Zhong Li Nov. 5, 2018, 12:33 p.m. UTC | #1
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf

> Of Linjie Fu

> Sent: Monday, November 5, 2018 5:41 PM

> To: ffmpeg-devel@ffmpeg.org

> Cc: Fu, Linjie <linjie.fu@intel.com>

> Subject: [FFmpeg-devel] [PATCH] avcodec/qsvenc: add default initiaize for

> pict_type

> 

> add default initiaize for pict_type in function ff_qsv_encode to avoid using

> uninitialized value:

> 

> FF_DISABLE_DEPRECATION_WARNINGS

>         avctx->coded_frame->pict_type = pict_type;

> FF_ENABLE_DEPRECATION_WARNINGS

> 

> Signed-off-by: Linjie Fu <linjie.fu@intel.com>

> ---

>  libavcodec/qsvenc.c | 2 ++

>  1 file changed, 2 insertions(+)

> 

> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index

> 7a031297fe..564222ca10 100644

> --- a/libavcodec/qsvenc.c

> +++ b/libavcodec/qsvenc.c

> @@ -1333,6 +1333,8 @@ int ff_qsv_encode(AVCodecContext *avctx,

> QSVEncContext *q,

>              pict_type = AV_PICTURE_TYPE_P;

>          else if (bs->FrameType & MFX_FRAMETYPE_B || bs->FrameType

> & MFX_FRAMETYPE_xB)

>              pict_type = AV_PICTURE_TYPE_B;

> +        else

> +            pict_type = AV_PICTURE_TYPE_NONE;


Should be better to give an assert?
diff mbox

Patch

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 7a031297fe..564222ca10 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1333,6 +1333,8 @@  int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q,
             pict_type = AV_PICTURE_TYPE_P;
         else if (bs->FrameType & MFX_FRAMETYPE_B || bs->FrameType & MFX_FRAMETYPE_xB)
             pict_type = AV_PICTURE_TYPE_B;
+        else
+            pict_type = AV_PICTURE_TYPE_NONE;
 
 #if FF_API_CODED_FRAME
 FF_DISABLE_DEPRECATION_WARNINGS