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.
This commit is contained in:
Tim-Philipp Müller 2008-04-30 14:20:48 +00:00
parent 0da9f87257
commit 449a426169
3 changed files with 20 additions and 5 deletions

View file

@ -1,3 +1,17 @@
2008-04-30 Tim-Philipp Müller <tim.muller at collabora co uk>
* 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 <wim.taymans@collabora.co.uk>
Patch by: Jonas Holmberg <jonas dot holmberg at axis dot com>

View file

@ -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

View file

@ -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");