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

Tong Wu tong1.wu at intel.com
Thu Feb 24 04:27:39 EET 2022


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:
-- 
2.16.1.windows.4



More information about the ffmpeg-devel mailing list