glimagesink: don't push a reconfigure event from the GL thread

Doing so may cause deadlocks when other elements attempt destroy or created
GL resources.

https://bugzilla.gnome.org/show_bug.cgi?id=760559
This commit is contained in:
Matthew Waters 2016-01-13 13:17:56 +11:00
parent 5b1872e387
commit ccc17ebe10
2 changed files with 21 additions and 8 deletions

View file

@ -1474,6 +1474,15 @@ gst_glimage_sink_prepare (GstBaseSink * bsink, GstBuffer * buf)
gst_gl_sync_meta_wait (sync_meta, glimage_sink->context);
GST_GLIMAGE_SINK_LOCK (glimage_sink);
if (glimage_sink->window_resized) {
glimage_sink->window_resized = FALSE;
GST_GLIMAGE_SINK_UNLOCK (glimage_sink);
GST_DEBUG_OBJECT (glimage_sink, "Sending reconfigure event on sinkpad.");
gst_pad_push_event (GST_BASE_SINK (glimage_sink)->sinkpad,
gst_event_new_reconfigure ());
GST_GLIMAGE_SINK_LOCK (glimage_sink);
}
target = &glimage_sink->input_buffer;
if (GST_VIDEO_INFO_MULTIVIEW_MODE (&glimage_sink->in_info) ==
GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME &&
@ -1885,7 +1894,7 @@ gst_glimage_sink_on_resize (GstGLImageSink * gl_sink, gint width, gint height)
height = MAX (1, height);
/* Check if we would suggest a different width/height now */
reconfigure = ((gl_sink->window_width != width)
gl_sink->window_resized = ((gl_sink->window_width != width)
|| (gl_sink->window_height != height))
&& (gl_sink->window_width != 0)
&& (gl_sink->window_height != 0);
@ -1893,12 +1902,6 @@ gst_glimage_sink_on_resize (GstGLImageSink * gl_sink, gint width, gint height)
gl_sink->window_width = width;
gl_sink->window_height = height;
if (reconfigure) {
GST_DEBUG ("Sending reconfigure event on sinkpad.");
gst_pad_push_event (GST_BASE_SINK (gl_sink)->sinkpad,
gst_event_new_reconfigure ());
}
gst_gl_insert_debug_marker (gl_sink->context, "%s window resize to %ix%i",
GST_OBJECT_NAME (gl_sink), width, height);
@ -2119,6 +2122,15 @@ gst_glimage_sink_redisplay (GstGLImageSink * gl_sink)
/* Recreate the output texture if needed */
GST_GLIMAGE_SINK_LOCK (gl_sink);
if (gl_sink->window_resized) {
gl_sink->window_resized = FALSE;
GST_GLIMAGE_SINK_UNLOCK (gl_sink);
GST_DEBUG_OBJECT (gl_sink, "Sending reconfigure event on sinkpad.");
gst_pad_push_event (GST_BASE_SINK (gl_sink)->sinkpad,
gst_event_new_reconfigure ());
GST_GLIMAGE_SINK_LOCK (gl_sink);
}
if (gl_sink->output_mode_changed && gl_sink->input_buffer != NULL) {
GST_DEBUG ("Recreating output after mode/size change");
update_output_format (gl_sink);

View file

@ -102,7 +102,8 @@ struct _GstGLImageSink
GstGLSyncMeta *stored_sync_meta;
GLuint redisplay_texture;
gboolean caps_change;
/* protected with drawing_lock */
gboolean window_resized;
guint window_width;
guint window_height;