Module: libav
Branch: master
Commit: ccbb31c14b766ef666ef2daa8c467e478183a957

Author:    Luca Barbato <lu_z...@gentoo.org>
Committer: Luca Barbato <lu_z...@gentoo.org>
Date:      Mon Sep 25 09:57:30 2017 +0000

qsv: Make sure the session is set with the latest version

It is needed to have the calls to MFXJoinSession succeed.

---

 libavutil/hwcontext_qsv.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index e0f6875..5018a05 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -1029,6 +1029,23 @@ static int 
qsv_device_derive_from_child(AVHWDeviceContext *ctx,
         goto fail;
     }
 
+    err = MFXQueryVersion(hwctx->session, &ver);
+    if (err != MFX_ERR_NONE) {
+        av_log(ctx, AV_LOG_ERROR, "Error querying an MFX session: %d.\n", err);
+        ret = AVERROR_UNKNOWN;
+        goto fail;
+    }
+
+    MFXClose(hwctx->session);
+
+    err = MFXInit(implementation, &ver, &hwctx->session);
+    if (err != MFX_ERR_NONE) {
+        av_log(ctx, AV_LOG_ERROR,
+               "Error initializing an MFX session: %d.\n", err);
+        ret = AVERROR_UNKNOWN;
+        goto fail;
+    }
+
     err = MFXVideoCORE_SetHandle(hwctx->session, handle_type, handle);
     if (err != MFX_ERR_NONE) {
         av_log(ctx, AV_LOG_ERROR, "Error setting child device handle: "

_______________________________________________
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to