[FFmpeg-cvslog] lavc/qsvdec: track the runtime session version

Haihao Xiang git at videolan.org
Sat Jan 29 06:14:16 EET 2022


ffmpeg | branch: master | Haihao Xiang <haihao.xiang at intel.com> | Mon Jan 24 16:24:54 2022 +0800| [7c24a768d3e9625183835c1051a72158154a11d8] | committer: Haihao Xiang

lavc/qsvdec: track the runtime session version

We may check the runtime version for the given features

Signed-off-by: Haihao Xiang <haihao.xiang at intel.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7c24a768d3e9625183835c1051a72158154a11d8
---

 libavcodec/qsvdec.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 783d252002..8b83d5695f 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -59,6 +59,7 @@ static const AVRational mfx_tb = { 1, 90000 };
 typedef struct QSVContext {
     // the session used for decoding
     mfxSession session;
+    mfxVersion ver;
 
     // the session we allocated internally, in case the caller did not provide
     // one
@@ -202,6 +203,18 @@ static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession ses
         q->session = q->internal_qs.session;
     }
 
+    if (MFXQueryVersion(q->session, &q->ver) != MFX_ERR_NONE) {
+        av_log(avctx, AV_LOG_ERROR, "Error querying the session version. \n");
+        q->session = NULL;
+
+        if (q->internal_qs.session) {
+            MFXClose(q->internal_qs.session);
+            q->internal_qs.session = NULL;
+        }
+
+        return AVERROR_EXTERNAL;
+    }
+
     /* make sure the decoder is uninitialized */
     MFXVideoDECODE_Close(q->session);
 



More information about the ffmpeg-cvslog mailing list