From 6a4b9177e4a2c1b0b3e106b55f6282894f0f604e Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Mon, 31 Jan 2005 23:21:52 +0000 Subject: [PATCH] gst/gstbin.c: Explicitely make an element release locks in a group when being remove from a bin. Original commit message from CVS: * gst/gstbin.c: (gst_bin_remove_func): Explicitely make an element release locks in a group when being remove from a bin. * gst/gstqueue.c: (gst_queue_chain), (gst_queue_get): If there's no scheduler, always return immediately (similar to gst_element_interrupt). --- ChangeLog | 9 +++++++++ gst/gstbin.c | 3 +++ gst/gstqueue.c | 12 ++++++++---- plugins/elements/gstqueue.c | 12 ++++++++---- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9f8041d..267714e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-02-01 Ronald S. Bultje + + * gst/gstbin.c: (gst_bin_remove_func): + Explicitely make an element release locks in a group when being + remove from a bin. + * gst/gstqueue.c: (gst_queue_chain), (gst_queue_get): + If there's no scheduler, always return immediately (similar to + gst_element_interrupt). + 2005-01-31 Ronald S. Bultje * gst/gstbin.c: (gst_bin_child_state_change_func): diff --git a/gst/gstbin.c b/gst/gstbin.c index 346e86f..438ccef 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -555,6 +555,9 @@ gst_bin_remove_func (GstBin * bin, GstElement * element) /* remove this element from the list of managed elements */ gst_bin_unset_element_sched (element, GST_ELEMENT_SCHED (bin)); + /* if it is still iterating, make it stop */ + gst_element_release_locks (element); + /* now remove the element from the list of elements */ bin->children = g_list_remove (bin->children, element); bin->numchildren--; diff --git a/gst/gstqueue.c b/gst/gstqueue.c index 11662bd..2386634 100644 --- a/gst/gstqueue.c +++ b/gst/gstqueue.c @@ -654,10 +654,12 @@ restart: * or its manager, switch back to iterator so bottom * half of state change executes */ if (queue->interrupt) { + GstScheduler *sched; + GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "interrupted"); GST_QUEUE_MUTEX_UNLOCK; - if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->sinkpad), - GST_ELEMENT (queue))) { + sched = gst_pad_get_scheduler (queue->sinkpad); + if (!sched || gst_scheduler_interrupt (sched, GST_ELEMENT (queue))) { goto out_unref; } /* if we got here because we were unlocked after a @@ -778,10 +780,12 @@ restart: * manager, switch back to iterator so bottom half of state * change executes. */ if (queue->interrupt) { + GstScheduler *sched; + GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "interrupted"); GST_QUEUE_MUTEX_UNLOCK; - if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->srcpad), - GST_ELEMENT (queue))) + sched = gst_pad_get_scheduler (queue->srcpad); + if (!sched || gst_scheduler_interrupt (sched, GST_ELEMENT (queue))) return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT)); goto restart; } diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index 11662bd..2386634 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -654,10 +654,12 @@ restart: * or its manager, switch back to iterator so bottom * half of state change executes */ if (queue->interrupt) { + GstScheduler *sched; + GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "interrupted"); GST_QUEUE_MUTEX_UNLOCK; - if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->sinkpad), - GST_ELEMENT (queue))) { + sched = gst_pad_get_scheduler (queue->sinkpad); + if (!sched || gst_scheduler_interrupt (sched, GST_ELEMENT (queue))) { goto out_unref; } /* if we got here because we were unlocked after a @@ -778,10 +780,12 @@ restart: * manager, switch back to iterator so bottom half of state * change executes. */ if (queue->interrupt) { + GstScheduler *sched; + GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "interrupted"); GST_QUEUE_MUTEX_UNLOCK; - if (gst_scheduler_interrupt (gst_pad_get_scheduler (queue->srcpad), - GST_ELEMENT (queue))) + sched = gst_pad_get_scheduler (queue->srcpad); + if (!sched || gst_scheduler_interrupt (sched, GST_ELEMENT (queue))) return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT)); goto restart; } -- 2.7.4