Commit 665f4a14 authored by Sreerenj Balachandran's avatar Sreerenj Balachandran
Browse files

mskd: vpp: error out gracefully instead of segfaulting if Init failed

Since we do the MSDK initializing in set_caps(), a FALSE
return may still cause the invokation of set_caps() again
and this will leads to buffer allocation and other mess-up.
So make sure the msdk initialized correctly before trying
to do any buffer allocation.

https://bugzilla.gnome.org/show_bug.cgi?id=796465
parent 6cd12cb6
......@@ -1019,6 +1019,7 @@ gst_msdkvpp_initialize (GstMsdkVPP * thiz)
msdk_status_to_string (status));
}
thiz->initialized = TRUE;
GST_OBJECT_UNLOCK (thiz);
return TRUE;
......@@ -1058,7 +1059,7 @@ gst_msdkvpp_set_caps (GstBaseTransform * trans, GstCaps * caps,
thiz->use_video_memory = FALSE;
#endif
if (!sinkpad_info_changed && !srcpad_info_changed)
if (!sinkpad_info_changed && !srcpad_info_changed && thiz->initialized)
return TRUE;
/* check for deinterlace requirement */
......@@ -1480,6 +1481,7 @@ gst_msdkvpp_class_init (GstMsdkVPPClass * klass)
static void
gst_msdkvpp_init (GstMsdkVPP * thiz)
{
thiz->initialized = FALSE;
thiz->hardware = PROP_HARDWARE_DEFAULT;
thiz->async_depth = PROP_ASYNC_DEPTH_DEFAULT;
thiz->denoise_factor = PROP_DENOISE_DEFAULT;
......
......@@ -95,6 +95,7 @@ struct _GstMsdkVPP
mfxFrameAllocResponse in_alloc_resp;
mfxFrameAllocResponse out_alloc_resp;
gboolean initialized;
gboolean use_video_memory;
gboolean use_sinkpad_dmabuf;
gboolean use_srcpad_dmabuf;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment