diff options
author | Matej Knopp <matej.knopp@gmail.com> | 2013-09-03 23:59:05 +0200 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2013-09-04 10:52:13 +0200 |
commit | 7f657358a843afcc2d301773dd122adfe06b4b9f (patch) | |
tree | e09ebedeb862b946270108619cab8776ade063cd /plugins/elements | |
parent | 8ba5fb0b28f479b924b779095dc44d9504ce7ce5 (diff) |
multiqueue: Don't reduce single queue visible size below its current level
If the multiqueue has automatically grown chances are good that
we will cause the pipeline to starve if the maximum level is reduced
below that automatically grown size.
https://bugzilla.gnome.org/show_bug.cgi?id=707156
Diffstat (limited to 'plugins/elements')
-rw-r--r-- | plugins/elements/gstmultiqueue.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c index a83220d6b..8a7a45ea6 100644 --- a/plugins/elements/gstmultiqueue.c +++ b/plugins/elements/gstmultiqueue.c @@ -495,11 +495,30 @@ gst_multi_queue_set_property (GObject * object, guint prop_id, GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); break; case PROP_MAX_SIZE_BUFFERS: + { + GList *tmp; + gint new_size = g_value_get_uint (value); + GST_MULTI_QUEUE_MUTEX_LOCK (mq); - mq->max_size.visible = g_value_get_uint (value); - SET_CHILD_PROPERTY (mq, visible); + + tmp = mq->queues; + while (tmp) { + GstDataQueueSize size; + GstSingleQueue *q = (GstSingleQueue *) tmp->data; + gst_data_queue_get_level (q->queue, &size); + + /* do not reduce max size below current level if the single queue has grown because of empty queue */ + if (new_size >= size.visible && size.visible <= mq->max_size.visible) + q->max_size.visible = new_size; + tmp = g_list_next (tmp); + }; + + mq->max_size.visible = new_size; + GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); + break; + } case PROP_MAX_SIZE_TIME: GST_MULTI_QUEUE_MUTEX_LOCK (mq); mq->max_size.time = g_value_get_uint64 (value); @@ -704,7 +723,12 @@ gst_multi_queue_change_state (GstElement * element, GstStateChange transition) sq = (GstSingleQueue *) tmp->data; sq->flushing = FALSE; } + + /* the visible limit might not have been set on single queues that have grown because of other queueus were empty */ + SET_CHILD_PROPERTY (mqueue, visible); + GST_MULTI_QUEUE_MUTEX_UNLOCK (mqueue); + break; } case GST_STATE_CHANGE_PAUSED_TO_READY:{ |