mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
msdk: check the created context against NULL pointer
gst_msdk_context_new_with_parent() may return NULL
This commit is contained in:
parent
801189c02f
commit
718b7d0b5d
3 changed files with 27 additions and 6 deletions
|
@ -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));
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue