msdk: check the created context against NULL pointer

gst_msdk_context_new_with_parent() may return NULL
This commit is contained in:
Haihao Xiang 2018-12-12 12:52:46 +08:00 committed by Víctor Manuel Jáquez Leal
parent 801189c02f
commit 718b7d0b5d
3 changed files with 27 additions and 6 deletions

View file

@ -649,10 +649,17 @@ gst_msdkdec_start (GstVideoDecoder * decoder)
thiz->use_video_memory = TRUE;
if (gst_msdk_context_get_job_type (thiz->context) & GST_MSDK_JOB_DECODER) {
GstMsdkContext *parent_context;
GstMsdkContext *parent_context, *msdk_context;
parent_context = thiz->context;
thiz->context = gst_msdk_context_new_with_parent (parent_context);
msdk_context = gst_msdk_context_new_with_parent (parent_context);
if (!msdk_context) {
GST_ERROR_OBJECT (thiz, "Context creation failed");
return FALSE;
}
thiz->context = msdk_context;
gst_msdk_context_add_shared_async_depth (thiz->context,
gst_msdk_context_get_shared_async_depth (parent_context));

View file

@ -1371,10 +1371,17 @@ gst_msdkenc_start (GstVideoEncoder * encoder)
thiz->context);
if (gst_msdk_context_get_job_type (thiz->context) & GST_MSDK_JOB_ENCODER) {
GstMsdkContext *parent_context;
GstMsdkContext *parent_context, *msdk_context;
parent_context = thiz->context;
thiz->context = gst_msdk_context_new_with_parent (parent_context);
msdk_context = gst_msdk_context_new_with_parent (parent_context);
if (!msdk_context) {
GST_ERROR_OBJECT (thiz, "Context creation failed");
return FALSE;
}
thiz->context = msdk_context;
gst_object_unref (parent_context);
GST_INFO_OBJECT (thiz,

View file

@ -144,10 +144,17 @@ ensure_context (GstBaseTransform * trans)
thiz->context);
if (gst_msdk_context_get_job_type (thiz->context) & GST_MSDK_JOB_VPP) {
GstMsdkContext *parent_context;
GstMsdkContext *parent_context, *msdk_context;
parent_context = thiz->context;
thiz->context = gst_msdk_context_new_with_parent (parent_context);
msdk_context = gst_msdk_context_new_with_parent (parent_context);
if (!msdk_context) {
GST_ERROR_OBJECT (thiz, "Context creation failed");
return FALSE;
}
thiz->context = msdk_context;
gst_object_unref (parent_context);
GST_INFO_OBJECT (thiz,