queue/queue2: Ensure that the streaming thread is unlocked after deactivating the...
authorSebastian Dröge <sebastian@centricular.com>
Tue, 13 Dec 2016 18:00:55 +0000 (20:00 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Tue, 13 Dec 2016 19:03:54 +0000 (21:03 +0200)
It might happen that the srcpad task function is never called at all, in
which case unlocking everything from there will never happen.

Make sure to unlock everything another time after the task function is
definitely stopped.

https://bugzilla.gnome.org/show_bug.cgi?id=776039

plugins/elements/gstqueue.c
plugins/elements/gstqueue2.c

index c3176b9..1f0c09c 100644 (file)
@@ -1729,6 +1729,10 @@ gst_queue_src_activate_mode (GstPad * pad, GstObject * parent, GstPadMode mode,
 
         /* step 2, make sure streaming finishes */
         result = gst_pad_stop_task (pad);
+
+        GST_QUEUE_MUTEX_LOCK (queue);
+        gst_queue_locked_flush (queue, FALSE);
+        GST_QUEUE_MUTEX_UNLOCK (queue);
       }
       break;
     default:
index 478a107..4c670a0 100644 (file)
@@ -3509,6 +3509,10 @@ gst_queue2_src_activate_push (GstPad * pad, GstObject * parent, gboolean active)
 
     /* step 2, make sure streaming finishes */
     result = gst_pad_stop_task (pad);
+
+    GST_QUEUE2_MUTEX_LOCK (queue);
+    gst_queue2_locked_flush (queue, FALSE, FALSE);
+    GST_QUEUE2_MUTEX_UNLOCK (queue);
   }
 
   return result;