mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
d3d11: Protect ID3D11VideoContext with lock
Likewise d3d11 immediate context (i.e., ID3D11DeviceContext), ID3D11VideoContext API is not thread safe. It must be protected therefore. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1856>
This commit is contained in:
parent
cc44634422
commit
22990bb9ea
2 changed files with 11 additions and 8 deletions
|
@ -1523,6 +1523,7 @@ gst_d3d11_convert_set_info (GstD3D11BaseFilter * filter,
|
||||||
gboolean hardware = FALSE;
|
gboolean hardware = FALSE;
|
||||||
GstD3D11VideoProcessor *processor = NULL;
|
GstD3D11VideoProcessor *processor = NULL;
|
||||||
|
|
||||||
|
gst_d3d11_device_lock (filter->device);
|
||||||
g_object_get (filter->device, "hardware", &hardware, NULL);
|
g_object_get (filter->device, "hardware", &hardware, NULL);
|
||||||
if (hardware) {
|
if (hardware) {
|
||||||
processor = gst_d3d11_video_processor_new (filter->device,
|
processor = gst_d3d11_video_processor_new (filter->device,
|
||||||
|
@ -1566,6 +1567,7 @@ gst_d3d11_convert_set_info (GstD3D11BaseFilter * filter,
|
||||||
}
|
}
|
||||||
|
|
||||||
self->processor = processor;
|
self->processor = processor;
|
||||||
|
gst_d3d11_device_unlock (filter->device);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -544,11 +544,8 @@ gst_d3d11_window_prepare (GstD3D11Window * window, guint display_width,
|
||||||
GST_ERROR_OBJECT (window, "Cannot create swapchain");
|
GST_ERROR_OBJECT (window, "Cannot create swapchain");
|
||||||
g_set_error (error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_FAILED,
|
g_set_error (error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_FAILED,
|
||||||
"Cannot create swapchain");
|
"Cannot create swapchain");
|
||||||
gst_d3d11_device_unlock (window->device);
|
goto error;
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
gst_d3d11_device_unlock (window->device);
|
|
||||||
|
|
||||||
/* this rect struct will be used to calculate render area */
|
/* this rect struct will be used to calculate render area */
|
||||||
window->render_rect.left = 0;
|
window->render_rect.left = 0;
|
||||||
|
@ -737,8 +734,7 @@ gst_d3d11_window_prepare (GstD3D11Window * window, guint display_width,
|
||||||
GST_ERROR_OBJECT (window, "Cannot create converter");
|
GST_ERROR_OBJECT (window, "Cannot create converter");
|
||||||
g_set_error (error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_FAILED,
|
g_set_error (error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_FAILED,
|
||||||
"Cannot create converter");
|
"Cannot create converter");
|
||||||
|
goto error;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window->compositor =
|
window->compositor =
|
||||||
|
@ -747,9 +743,9 @@ gst_d3d11_window_prepare (GstD3D11Window * window, guint display_width,
|
||||||
GST_ERROR_OBJECT (window, "Cannot create overlay compositor");
|
GST_ERROR_OBJECT (window, "Cannot create overlay compositor");
|
||||||
g_set_error (error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_FAILED,
|
g_set_error (error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_FAILED,
|
||||||
"Cannot create overlay compositor");
|
"Cannot create overlay compositor");
|
||||||
|
goto error;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
gst_d3d11_device_unlock (window->device);
|
||||||
|
|
||||||
/* call resize to allocated resources */
|
/* call resize to allocated resources */
|
||||||
klass->on_resize (window, display_width, display_height);
|
klass->on_resize (window, display_width, display_height);
|
||||||
|
@ -761,6 +757,11 @@ gst_d3d11_window_prepare (GstD3D11Window * window, guint display_width,
|
||||||
GST_DEBUG_OBJECT (window, "New swap chain 0x%p created", window->swap_chain);
|
GST_DEBUG_OBJECT (window, "New swap chain 0x%p created", window->swap_chain);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
error:
|
||||||
|
gst_d3d11_device_unlock (window->device);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue