summaryrefslogtreecommitdiff
path: root/sys/msdk
diff options
context:
space:
mode:
authorHaihao Xiang <haihao.xiang@intel.com>2018-12-14 10:18:25 +0800
committerHaihao Xiang <haihao.xiang@intel.com>2019-01-08 10:08:43 +0800
commit7681566f2948c5a3ddb9ddda41daa8af60bcbbdc (patch)
tree2d3518cff2c176bef79d1b244b48b1e8e23537f2 /sys/msdk
parente8d2f58e23f9b2908b2d7e66ba43cf6405fcc224 (diff)
downloadgstreamer-plugins-bad-7681566f2948c5a3ddb9ddda41daa8af60bcbbdc.tar.gz
msdkvpp: close the current VPP session if this session has been initialized
Otherwise MFXVideoVPP_Init will fail because it is called twice without a close. Example pipeline: gst-launch-1.0 videotestsrc ! msdkvpp ! glimagesink Sometimes glimagesink emits GST_EVENT_RECONFIGURE event which results in that MFXVideoVPP_Init is called twice, then get the negotiation failure below: 0:00:00.093715518 21218 0x558ef56231e0 ERROR msdkvpp gstmsdkvpp.c:995:gst_msdkvpp_initialize:<msdkvpp0> Init failed (undefined behavior) WARNING: from element /GstPipeline:pipeline0/GstMsdkVPP:msdkvpp0: not negotiated After applying this commit, the pipeline above may run without negotiation failure, however NV12 layout in dmabuf mode is selected in renegotiation, the display image is corrupted due to the NV12 issue which was mentioned in commit 3f2314a. Some other fixes are needed to avoid renegotiation by default
Diffstat (limited to 'sys/msdk')
-rw-r--r--sys/msdk/gstmsdkvpp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/msdk/gstmsdkvpp.c b/sys/msdk/gstmsdkvpp.c
index f52956544..95f5f17a0 100644
--- a/sys/msdk/gstmsdkvpp.c
+++ b/sys/msdk/gstmsdkvpp.c
@@ -904,6 +904,13 @@ gst_msdkvpp_initialize (GstMsdkVPP * thiz)
GST_OBJECT_LOCK (thiz);
session = gst_msdk_context_get_session (thiz->context);
+ /* Close the current session if the session has been initialized,
+ * otherwise the subsequent function call of MFXVideoVPP_Init() will
+ * fail
+ */
+ if (thiz->initialized)
+ MFXVideoVPP_Close (session);
+
if (thiz->use_video_memory) {
gst_msdk_set_frame_allocator (thiz->context);
thiz->param.IOPattern =