From 4f928547a8f13b5755f19caaf4fe55d8dd1c9b94 Mon Sep 17 00:00:00 2001 From: Per x Johansson Date: Thu, 23 Jan 2014 15:47:23 +0100 Subject: [PATCH] multiqueue: Allow growing a queue if all other queues are not linked In the case where one singlequeue is full and all other are not linked, the growing of the full queue does not work correctly. The result depends on if the full queue is last in the queue list or not. https://bugzilla.gnome.org/show_bug.cgi?id=722891 --- plugins/elements/gstmultiqueue.c | 43 +++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c index 434902f..2f1a1bf 100644 --- a/plugins/elements/gstmultiqueue.c +++ b/plugins/elements/gstmultiqueue.c @@ -1904,6 +1904,7 @@ single_queue_overrun_cb (GstDataQueue * dq, GstSingleQueue * sq) GstDataQueueSize size; gboolean filled = TRUE; gboolean all_not_linked = TRUE; + gboolean empty_found = FALSE; gst_data_queue_get_level (sq->queue, &size); @@ -1921,8 +1922,7 @@ single_queue_overrun_cb (GstDataQueue * dq, GstSingleQueue * sq) goto done; } - /* if hard limits are not reached then we allow one more buffer in the full - * queue, but only if any of the other singelqueues are empty */ + /* Search for empty or unlinked queues */ for (tmp = mq->queues; tmp; tmp = g_list_next (tmp)) { GstSingleQueue *oq = (GstSingleQueue *) tmp->data; @@ -1931,28 +1931,31 @@ single_queue_overrun_cb (GstDataQueue * dq, GstSingleQueue * sq) if (oq->srcresult == GST_FLOW_NOT_LINKED) { GST_LOG_OBJECT (mq, "Queue %d is not-linked", oq->id); - if (!all_not_linked || tmp->next) continue; - } else { - all_not_linked = FALSE; - GST_LOG_OBJECT (mq, "Checking Queue %d", oq->id); } - if (gst_data_queue_is_empty (oq->queue) - || oq->srcresult == GST_FLOW_NOT_LINKED) { - if (oq->srcresult == GST_FLOW_NOT_LINKED) - GST_LOG_OBJECT (mq, "All other queues are not linked"); - else - GST_LOG_OBJECT (mq, "Queue %d is empty", oq->id); + all_not_linked = FALSE; + GST_LOG_OBJECT (mq, "Checking Queue %d", oq->id); - if (IS_FILLED (sq, visible, size.visible)) { - sq->max_size.visible = size.visible + 1; - GST_DEBUG_OBJECT (mq, - "Bumping single queue %d max visible to %d", - sq->id, sq->max_size.visible); - filled = FALSE; - break; - } + if (gst_data_queue_is_empty (oq->queue)) { + GST_LOG_OBJECT (mq, "Queue %d is empty", oq->id); + empty_found = TRUE; + } + } + + /* if hard limits are not reached then we allow one more buffer in the full + * queue, but only if any of the other singelqueues are empty or all are + * not linked */ + if (all_not_linked || empty_found) { + if (all_not_linked) { + GST_LOG_OBJECT (mq, "All other queues are not linked"); + } + if (IS_FILLED (sq, visible, size.visible)) { + sq->max_size.visible = size.visible + 1; + GST_DEBUG_OBJECT (mq, + "Bumping single queue %d max visible to %d", + sq->id, sq->max_size.visible); + filled = FALSE; } } -- 2.7.4