From e425bd31a193a5b4249d11e49e669bc6a33d398b Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Fri, 30 May 2014 11:46:00 +1000 Subject: [PATCH] glimagesink: unref the old buffer outside the lock it could very well deadlock https://bugzilla.gnome.org/show_bug.cgi?id=723529 --- ext/gl/gstglimagesink.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c index 2f40fe1459..587d23fcd7 100644 --- a/ext/gl/gstglimagesink.c +++ b/ext/gl/gstglimagesink.c @@ -759,6 +759,7 @@ static GstFlowReturn gst_glimage_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf) { GstGLImageSink *glimage_sink; + GstBuffer *stored_buffer; GST_TRACE ("rendering buffer:%p", buf); @@ -773,8 +774,11 @@ gst_glimage_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf) /* Avoid to release the texture while drawing */ GST_GLIMAGE_SINK_LOCK (glimage_sink); glimage_sink->redisplay_texture = glimage_sink->next_tex; - gst_buffer_replace (&glimage_sink->stored_buffer, buf); + stored_buffer = glimage_sink->stored_buffer; + glimage_sink->stored_buffer = gst_buffer_ref (buf); GST_GLIMAGE_SINK_UNLOCK (glimage_sink); + if (stored_buffer) + gst_buffer_unref (stored_buffer); /* Ask the underlying window to redraw its content */ if (!gst_glimage_sink_redisplay (glimage_sink))