summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2015-12-18 11:49:25 +1100
committerMatthew Waters <matthew@centricular.com>2015-12-18 11:57:07 +1100
commita3ebe19d8704200d6c2371b6c4a5a4efe1484643 (patch)
tree7fd9a1958970d799e747049dafb0baa9c157af98 /ext
parentae0b8e060ee781962f73b1a2c90a60cc52c325cd (diff)
downloadgstreamer-plugins-bad-a3ebe19d8704200d6c2371b6c4a5a4efe1484643.tar.gz
glimagesink: don't deadlock on resize
Performing any GL function marshalling off the GL thread with glimagesink's render lock is prone to deadlocks between the GL thread and the non-GL thread. What can happen is this: 1. non-GL thread attempts to function marshal to the GL thread. 2. while 1 is happening, the winsys gives an event (say resize) 3. This calls back into glimagesink which taks the render lock. 4. As the GL function marshalling is attempting to run on the GL and already has glimagesink's render lock locked. This deadlocks as the threads are waiting for each other.
Diffstat (limited to 'ext')
-rw-r--r--ext/gl/gstglimagesink.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
index b456b838a..111033bf9 100644
--- a/ext/gl/gstglimagesink.c
+++ b/ext/gl/gstglimagesink.c
@@ -1466,6 +1466,10 @@ gst_glimage_sink_prepare (GstBaseSink * bsink, GstBuffer * buf)
if (!_ensure_gl_setup (glimage_sink))
return GST_FLOW_NOT_NEGOTIATED;
+ sync_meta = gst_buffer_get_gl_sync_meta (buf);
+ if (sync_meta)
+ gst_gl_sync_meta_wait (sync_meta, glimage_sink->context);
+
GST_GLIMAGE_SINK_LOCK (glimage_sink);
target = &glimage_sink->input_buffer;
if (GST_VIDEO_INFO_MULTIVIEW_MODE (&glimage_sink->in_info) ==
@@ -1479,10 +1483,6 @@ gst_glimage_sink_prepare (GstBaseSink * bsink, GstBuffer * buf)
if (glimage_sink->output_mode_changed)
update_output_format (glimage_sink);
- sync_meta = gst_buffer_get_gl_sync_meta (buf);
- if (sync_meta)
- gst_gl_sync_meta_wait (sync_meta, glimage_sink->context);
-
if (!prepare_next_buffer (glimage_sink)) {
GST_GLIMAGE_SINK_UNLOCK (glimage_sink);
if (old_input)