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
This commit is contained in:
Sreerenj Balachandran 2018-06-07 15:29:29 -08:00
parent 6cd12cb6a1
commit 665f4a140f
2 changed files with 4 additions and 1 deletions

View file

@ -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;

View file

@ -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;