summaryrefslogtreecommitdiff
path: root/gst-libs/gst
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2013-01-28 17:28:58 +0100
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2013-01-28 18:12:18 +0100
commit389bb77954e9dcd4cfac4a210927ff17f664a534 (patch)
treee32119a27e1465c1a16719452dd797fa1cc95e44 /gst-libs/gst
parent2e34707b54825f2c16241273a0e80f29d573bb64 (diff)
wayland: fix thread-safe issues.
The Wayland API is not fully thread-safe and client applications shall perform locking themselves on key functions. Besides, make sure to release the lock if the _render() function fails.
Diffstat (limited to 'gst-libs/gst')
-rw-r--r--gst-libs/gst/vaapi/gstvaapiwindow_wayland.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c b/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c
index e475514f..a26ab1ce 100644
--- a/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c
+++ b/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c
@@ -157,12 +157,16 @@ gst_vaapi_window_wayland_create(
g_return_val_if_fail(priv_display->compositor != NULL, FALSE);
g_return_val_if_fail(priv_display->shell != NULL, FALSE);
+ GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
priv->surface = wl_compositor_create_surface(priv_display->compositor);
+ GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
if (!priv->surface)
return FALSE;
+ GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
priv->shell_surface =
wl_shell_get_shell_surface(priv_display->shell, priv->surface);
+ GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
if (!priv->shell_surface)
return FALSE;
@@ -217,7 +221,9 @@ gst_vaapi_window_wayland_resize(
if (priv->opaque_region)
wl_region_destroy(priv->opaque_region);
+ GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
priv->opaque_region = wl_compositor_create_region(priv_display->compositor);
+ GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
wl_region_add(priv->opaque_region, 0, 0, width, height);
return TRUE;
@@ -299,8 +305,10 @@ gst_vaapi_window_wayland_render(
&buffer
);
}
- if (!vaapi_check_status(status, "vaGetSurfaceBufferWl()"))
+ if (!vaapi_check_status(status, "vaGetSurfaceBufferWl()")) {
+ GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);
return FALSE;
+ }
/* XXX: attach to the specified target rectangle */
wl_surface_attach(priv->surface, buffer, 0, 0);