plugins/elements/gstqueue.c: Since we're not called only from the chain function...
authorTim-Philipp Müller <tim@centricular.net>
Wed, 30 Apr 2008 14:20:48 +0000 (14:20 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Wed, 30 Apr 2008 14:20:48 +0000 (14:20 +0000)
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
plugins/elements/gstqueue.c
tests/check/elements/queue.c

index 4943eb2..e7c183b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
index 4cf27cd..9a9d711 100644 (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
index 51148d4..5e9d794 100644 (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");