From c31688b0f043a7550bf020e87fd97ad96c01f853 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 11 May 2006 19:07:48 +0000 Subject: [PATCH] plugins/elements/gstqueue.c: Don't forget to signal the _chain or _loop function when the queue size or thresholds ch... Original commit message from CVS: * plugins/elements/gstqueue.c: (gst_queue_chain), (gst_queue_loop), (gst_queue_set_property): Don't forget to signal the _chain or _loop function when the queue size or thresholds change since that might cause them to make progres again. --- ChangeLog | 8 ++++++++ plugins/elements/gstqueue.c | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8f51afc6cd..3baf7554ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-05-11 Wim Taymans + + * plugins/elements/gstqueue.c: (gst_queue_chain), (gst_queue_loop), + (gst_queue_set_property): + Don't forget to signal the _chain or _loop function + when the queue size or thresholds change since that might + cause them to make progres again. + 2006-05-11 Stefan Kost * gst/gstclock.c: (gst_clock_class_init): diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index e71eedf2ae..f7e7d136b7 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -682,6 +682,7 @@ gst_queue_chain (GstPad * pad, GstBuffer * buffer) case GST_QUEUE_NO_LEAK: STATUS (queue, pad, "pre-full wait"); + /* we recheck, the signal could have changed the thresholds */ while (gst_queue_is_filled (queue)) { STATUS (queue, pad, "waiting for item_del signal from thread using qlock"); @@ -840,6 +841,7 @@ restart: GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing); STATUS (queue, pad, "pre-empty wait"); + /* we recheck, the signal could have changed the thresholds */ while (gst_queue_is_empty (queue)) { STATUS (queue, pad, "waiting for item_add"); @@ -1045,6 +1047,19 @@ gst_queue_change_state (GstElement * element, GstStateChange transition) return ret; } +/* changing the capacity of the queue must wake up + * the _chain function, it might have more room now + * to store the buffer/event in the queue */ +#define QUEUE_CAPACITY_CHANGE(q)\ + g_cond_signal (queue->item_del); + +/* Changing the minimum required fill level must + * wake up the _loop function as it might now + * be able to preceed. + */ +#define QUEUE_THRESHOLD_CHANGE(q)\ + g_cond_signal (queue->item_add); + static void gst_queue_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) @@ -1058,24 +1073,30 @@ gst_queue_set_property (GObject * object, switch (prop_id) { case ARG_MAX_SIZE_BYTES: queue->max_size.bytes = g_value_get_uint (value); + QUEUE_CAPACITY_CHANGE (queue); break; case ARG_MAX_SIZE_BUFFERS: queue->max_size.buffers = g_value_get_uint (value); + QUEUE_CAPACITY_CHANGE (queue); break; case ARG_MAX_SIZE_TIME: queue->max_size.time = g_value_get_uint64 (value); + QUEUE_CAPACITY_CHANGE (queue); break; case ARG_MIN_THRESHOLD_BYTES: queue->min_threshold.bytes = g_value_get_uint (value); queue->orig_min_threshold.bytes = queue->min_threshold.bytes; + QUEUE_THRESHOLD_CHANGE (queue); break; case ARG_MIN_THRESHOLD_BUFFERS: queue->min_threshold.buffers = g_value_get_uint (value); queue->orig_min_threshold.buffers = queue->min_threshold.buffers; + QUEUE_THRESHOLD_CHANGE (queue); break; case ARG_MIN_THRESHOLD_TIME: queue->min_threshold.time = g_value_get_uint64 (value); queue->orig_min_threshold.time = queue->min_threshold.time; + QUEUE_THRESHOLD_CHANGE (queue); break; case ARG_LEAKY: queue->leaky = g_value_get_enum (value);