[FFmpeg-devel] [PATCH] qsv: add return value check for MFXQueryIMPL

Xiang, Haihao haihao.xiang at intel.com
Mon Feb 28 08:39:25 EET 2022


On Thu, 2022-02-24 at 10:27 +0800, Tong Wu wrote:
> add a return value check for function MFXQueryIMPL to handle the error
> message.
> 
> Signed-off-by: Tong Wu <tong1.wu at intel.com>
> ---
>  libavcodec/qsv.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
> index 1a432dbd82..18f34f05fd 100644
> --- a/libavcodec/qsv.c
> +++ b/libavcodec/qsv.c
> @@ -408,7 +408,10 @@ int ff_qsv_init_internal_session(AVCodecContext *avctx,
> QSVSession *qs,
>          return ret;
>      }
>  
> -    MFXQueryIMPL(qs->session, &impl);
> +    ret = MFXQueryIMPL(qs->session, &impl);
> +    if (ret != MFX_ERR_NONE)
> +        return ff_qsv_print_error(avctx, ret,
> +                                  "Error querying the session attributes");
>  
>      switch (MFX_IMPL_BASETYPE(impl)) {
>      case MFX_IMPL_SOFTWARE:

LGTM, applied

-Haihao



More information about the ffmpeg-devel mailing list