On 09/24/2017 09:55 PM, Luca Barbato wrote:

Should improve the performance on multiple transcoding from a single
source.
---
 libavcodec/qsv.c     | 2 ++
 libavfilter/qsvvpp.c | 1 +
 2 files changed, 3 insertions(+)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 56bfbb33d2..925dfaa4cc 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -594,6 +594,8 @@ int ff_qsv_init_session_device(AVCodecContext
*avctx, mfxSession *psession,
                                       "Error setting a HW handle");
     }

+    MFXJoinSession(parent_session, session);
+
     ret = qsv_load_plugins(session, load_plugins, avctx);
     if (ret < 0) {
         av_log(avctx, AV_LOG_ERROR, "Error loading plugins\n");
diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index c70050822c..6a38e9f0f9 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -516,6 +516,7 @@ static int init_vpp_session(AVFilterContext
*avctx, QSVVPPContext *s)
         if (ret != MFX_ERR_NONE)
             return AVERROR_UNKNOWN;
     }
+    MFXJoinSession(device_hwctx->session, s->session);

     if (IS_OPAQUE_MEMORY(s->in_mem_mode) ||
IS_OPAQUE_MEMORY(s->out_mem_mode)) {
         s->opaque_alloc.In.Surfaces   = s->surface_ptrs_in;

How about using "MFXCloneSession()" to shorten these codes?

In fact, for Linux,  "MFXJoinSession()" probably fails here because the
parent_session has the version of {3, 1} (see hwcontext_qsv.c),
but the child_seesion has the version queried by "MFXQueryIMPL", which
always returns the version of current libmfx, such as {20, 1}.
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to