From 449a4261691fb8f02e3262e6f8cf8ed3b8706b2b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 30 Apr 2008 14:20:48 +0000 Subject: [PATCH] plugins/elements/gstqueue.c: Since we're not called only from the chain function any longer, we can't assume that the... Original commit message from CVS: * plugins/elements/gstqueue.c: (gst_queue_leak_downstream): Since we're not called only from the chain function any longer, we can't assume that there's always data in the queue, so move the is_full check to the beginning of the loop (otherwise we'd hit the assert when changing the limit properties while the queue is empty or not running yet). Also, only set a discont if items were actually removed from the queue. * tests/check/elements/queue.c: (test_leaky_downstream): Test case for the above. --- ChangeLog | 14 ++++++++++++++ plugins/elements/gstqueue.c | 9 +++++---- tests/check/elements/queue.c | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4943eb2..e7c183b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2008-04-30 Tim-Philipp Müller + + * plugins/elements/gstqueue.c: (gst_queue_leak_downstream): + Since we're not called only from the chain function any longer, + we can't assume that there's always data in the queue, so move + the is_full check to the beginning of the loop (otherwise we'd + hit the assert when changing the limit properties while the + queue is empty or not running yet). + Also, only set a discont if items were actually removed from + the queue. + + * tests/check/elements/queue.c: (test_leaky_downstream): + Test case for the above. + 2008-04-30 Wim Taymans Patch by: Jonas Holmberg diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index 4cf27cd..9a9d711 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -835,7 +835,7 @@ static void gst_queue_leak_downstream (GstQueue * queue) { /* for as long as the queue is filled, dequeue an item and discard it */ - do { + while (gst_queue_is_filled (queue)) { GstMiniObject *leak; leak = gst_queue_locked_dequeue (queue); @@ -846,9 +846,10 @@ gst_queue_leak_downstream (GstQueue * queue) GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "queue is full, leaking item %p on downstream end", leak); gst_buffer_unref (leak); - } while (gst_queue_is_filled (queue)); - /* last buffer needs to get a DISCONT flag */ - queue->head_needs_discont = TRUE; + + /* last buffer needs to get a DISCONT flag */ + queue->head_needs_discont = TRUE; + } } static GstFlowReturn diff --git a/tests/check/elements/queue.c b/tests/check/elements/queue.c index 51148d4..5e9d794 100644 --- a/tests/check/elements/queue.c +++ b/tests/check/elements/queue.c @@ -267,7 +267,7 @@ GST_START_TEST (test_leaky_downstream) queue = setup_queue (); mysrcpad = gst_check_setup_src_pad (queue, &srctemplate, NULL); mysinkpad = gst_check_setup_sink_pad (queue, &sinktemplate, NULL); - g_object_set (G_OBJECT (queue), "max-size-buffers", 2, "leaky", 2, NULL); + g_object_set (G_OBJECT (queue), "leaky", 2, "max-size-buffers", 2, NULL); gst_pad_set_active (mysrcpad, TRUE); GST_DEBUG ("starting"); -- 2.7.4