mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 00:06:36 +00:00
d3dvideosink: use class lock when allocating pool buffer
This commit is contained in:
parent
52254ad31c
commit
fb6c2e8533
1 changed files with 12 additions and 0 deletions
|
@ -90,6 +90,11 @@ static gint WM_D3DVIDEO_NOTIFY_DEVICE_LOST = 0;
|
||||||
#define CASE_HR_DBG_END(sink, gst_err_msg) \
|
#define CASE_HR_DBG_END(sink, gst_err_msg) \
|
||||||
CASE_HR_DBG_ERR_END(sink, gst_err_msg, GST_LEVEL_DEBUG)
|
CASE_HR_DBG_ERR_END(sink, gst_err_msg, GST_LEVEL_DEBUG)
|
||||||
|
|
||||||
|
#define CHECK_REF_COUNT(klass, sink, goto_label) \
|
||||||
|
if(!klass->d3d.refs) { \
|
||||||
|
GST_ERROR_OBJECT(sink, "Direct3D object ref count = 0"); \
|
||||||
|
goto goto_label; \
|
||||||
|
}
|
||||||
#define CHECK_D3D_DEVICE(klass, sink, goto_label) \
|
#define CHECK_D3D_DEVICE(klass, sink, goto_label) \
|
||||||
if(!klass->d3d.d3d || !klass->d3d.device.d3d_device) { \
|
if(!klass->d3d.d3d || !klass->d3d.device.d3d_device) { \
|
||||||
GST_ERROR_OBJECT(sink, "Direct3D device or object does not exist"); \
|
GST_ERROR_OBJECT(sink, "Direct3D device or object does not exist"); \
|
||||||
|
@ -693,10 +698,14 @@ gst_d3dsurface_buffer_pool_alloc_buffer (GstBufferPool * bpool,
|
||||||
|
|
||||||
d3dformat =
|
d3dformat =
|
||||||
gst_video_format_to_d3d_format (GST_VIDEO_INFO_FORMAT (&pool->info));
|
gst_video_format_to_d3d_format (GST_VIDEO_INFO_FORMAT (&pool->info));
|
||||||
|
LOCK_CLASS (sink, klass);
|
||||||
|
CHECK_REF_COUNT (klass, sink, error);
|
||||||
|
CHECK_D3D_DEVICE (klass, sink, error);
|
||||||
hr = IDirect3DDevice9_CreateOffscreenPlainSurface (klass->d3d.
|
hr = IDirect3DDevice9_CreateOffscreenPlainSurface (klass->d3d.
|
||||||
device.d3d_device, GST_VIDEO_INFO_WIDTH (&pool->info),
|
device.d3d_device, GST_VIDEO_INFO_WIDTH (&pool->info),
|
||||||
GST_VIDEO_INFO_HEIGHT (&pool->info), d3dformat, D3DPOOL_DEFAULT, &surface,
|
GST_VIDEO_INFO_HEIGHT (&pool->info), d3dformat, D3DPOOL_DEFAULT, &surface,
|
||||||
NULL);
|
NULL);
|
||||||
|
UNLOCK_CLASS (sink, klass);
|
||||||
if (hr != D3D_OK) {
|
if (hr != D3D_OK) {
|
||||||
GST_ERROR_OBJECT (sink, "Failed to create D3D surface");
|
GST_ERROR_OBJECT (sink, "Failed to create D3D surface");
|
||||||
goto fallback;
|
goto fallback;
|
||||||
|
@ -747,6 +756,9 @@ fallback:
|
||||||
(gst_d3dsurface_buffer_pool_parent_class)->alloc_buffer (bpool, buffer,
|
(gst_d3dsurface_buffer_pool_parent_class)->alloc_buffer (bpool, buffer,
|
||||||
params);
|
params);
|
||||||
}
|
}
|
||||||
|
error:
|
||||||
|
UNLOCK_CLASS (sink, klass);
|
||||||
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue