mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +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;
|
||||
GstD3D11VideoProcessor *processor = NULL;
|
||||
|
||||
gst_d3d11_device_lock (filter->device);
|
||||
g_object_get (filter->device, "hardware", &hardware, NULL);
|
||||
if (hardware) {
|
||||
processor = gst_d3d11_video_processor_new (filter->device,
|
||||
|
@ -1566,6 +1567,7 @@ gst_d3d11_convert_set_info (GstD3D11BaseFilter * filter,
|
|||
}
|
||||
|
||||
self->processor = processor;
|
||||
gst_d3d11_device_unlock (filter->device);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -544,11 +544,8 @@ gst_d3d11_window_prepare (GstD3D11Window * window, guint display_width,
|
|||
GST_ERROR_OBJECT (window, "Cannot create swapchain");
|
||||
g_set_error (error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_FAILED,
|
||||
"Cannot create swapchain");
|
||||
gst_d3d11_device_unlock (window->device);
|
||||
|
||||
return FALSE;
|
||||
goto error;
|
||||
}
|
||||
gst_d3d11_device_unlock (window->device);
|
||||
|
||||
/* this rect struct will be used to calculate render area */
|
||||
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");
|
||||
g_set_error (error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_FAILED,
|
||||
"Cannot create converter");
|
||||
|
||||
return FALSE;
|
||||
goto error;
|
||||
}
|
||||
|
||||
window->compositor =
|
||||
|
@ -747,9 +743,9 @@ gst_d3d11_window_prepare (GstD3D11Window * window, guint display_width,
|
|||
GST_ERROR_OBJECT (window, "Cannot create overlay compositor");
|
||||
g_set_error (error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_FAILED,
|
||||
"Cannot create overlay compositor");
|
||||
|
||||
return FALSE;
|
||||
goto error;
|
||||
}
|
||||
gst_d3d11_device_unlock (window->device);
|
||||
|
||||
/* call resize to allocated resources */
|
||||
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);
|
||||
|
||||
return TRUE;
|
||||
|
||||
error:
|
||||
gst_d3d11_device_unlock (window->device);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue