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