From 33c239828bd0563114fddb4fece75f95a986d41e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 13 Dec 2016 20:00:55 +0200 Subject: [PATCH] queue/queue2: Ensure that the streaming thread is unlocked after deactivating the srcpad 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 | 4 ++++ plugins/elements/gstqueue2.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index c3176b9717..1f0c09cf15 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -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: diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c index 478a107ead..4c670a024b 100644 --- a/plugins/elements/gstqueue2.c +++ b/plugins/elements/gstqueue2.c @@ -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;