[Bug 702520] [regression] queue: deadlock when reconfigure event

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Tue Jun 18 12:18:19 PDT 2013


https://bugzilla.gnome.org/show_bug.cgi?id=702520
  GStreamer | gstreamer (core) | 1.1.1

--- Comment #7 from Aleix Conchillo Flaqué <aleix at oblong.com> 2013-06-18 19:18:17 UTC ---
A g_mutex_trylock in gst_queue_handle_src_event seems to solve the issue. But I
don't really know this code, so it might have side effects.

Everything works, though.

----------------

diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c
index 765005d..f9bf545 100644
--- a/plugins/elements/gstqueue.c
+++ b/plugins/elements/gstqueue.c
@@ -138,6 +138,8 @@ enum
     goto label;                                                         \
 } G_STMT_END

+#define GST_QUEUE_MUTEX_TRYLOCK(q) g_mutex_trylock (&q->qlock)
+
 #define GST_QUEUE_MUTEX_UNLOCK(q) G_STMT_START {                        \
   g_mutex_unlock (&q->qlock);                                            \
 } G_STMT_END
@@ -1283,18 +1285,20 @@ gst_queue_handle_src_event (GstPad * pad, GstObject *
parent, GstEvent * event)
 #endif

   switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_RECONFIGURE:
-      GST_QUEUE_MUTEX_LOCK (queue);
+    case GST_EVENT_RECONFIGURE: {
+      gboolean locked = GST_QUEUE_MUTEX_TRYLOCK (queue);
       if (queue->srcresult == GST_FLOW_NOT_LINKED) {
         /* when we got not linked, assume downstream is linked again now and
we
          * can try to start pushing again */
         queue->srcresult = GST_FLOW_OK;
         gst_pad_start_task (pad, (GstTaskFunction) gst_queue_loop, pad, NULL);
       }
-      GST_QUEUE_MUTEX_UNLOCK (queue);
+      if (locked)
+        GST_QUEUE_MUTEX_UNLOCK (queue);

       res = gst_pad_push_event (queue->sinkpad, event);
       break;
+    }
     default:
       res = gst_pad_event_default (pad, parent, event);
       break;

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list