[FFmpeg-devel] [PATCH] lavc/qsv: refine return value check for MFXQueryIMPL

Linjie Fu linjie.fu at intel.com
Tue Jan 21 10:42:50 EET 2020


Signed-off-by: Linjie Fu <linjie.fu at intel.com>
---
 libavcodec/qsv.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index db98c75..563b780 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -391,7 +391,10 @@ int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs,
         return ret;
     }
 
-    MFXQueryIMPL(qs->session, &impl);
+    ret = MFXQueryIMPL(qs->session, &impl);
+    if (ret < 0)
+        return ff_qsv_print_error(avctx, ret,
+                                  "Error querying the session attributes");
 
     switch (MFX_IMPL_BASETYPE(impl)) {
     case MFX_IMPL_SOFTWARE:
@@ -691,7 +694,7 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, mfxSession *psession,
     err = MFXQueryIMPL(parent_session, &impl);
     if (err == MFX_ERR_NONE)
         err = MFXQueryVersion(parent_session, &ver);
-    if (err != MFX_ERR_NONE)
+    else
         return ff_qsv_print_error(avctx, err,
                                   "Error querying the session attributes");
 
-- 
2.7.4



More information about the ffmpeg-devel mailing list