tests: collectpads: tweak stub _collect to push all buffers
authorAlessandro Decina <alessandro.d@gmail.com>
Mon, 16 Sep 2013 06:31:47 +0000 (08:31 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 11 Nov 2013 15:50:42 +0000 (16:50 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=708416

tests/check/libs/collectpads.c

index 19552c8..6de82d8 100644 (file)
@@ -69,13 +69,24 @@ gst_agregator_collected (GstCollectPads * pads, gpointer user_data)
 {
   GstAggregator *aggregator = GST_AGGREGATOR (user_data);
   GstBuffer *inbuf;
-  GstCollectData *collect_data = (GstCollectData *) pads->data->data;
-  guint outsize = gst_collect_pads_available (pads);
+  GstCollectData *collect_data = NULL;
+  guint outsize = 0;
+  GSList *walk;
+
+  walk = pads->data;
+  for (walk = pads->data; walk; walk = walk->next) {
+    GstCollectData *tmp = (GstCollectData *) walk->data;
+    if (tmp->buffer) {
+      collect_data = tmp;
+      break;
+    }
+  }
 
   /* can only happen when no pads to collect or all EOS */
-  if (outsize == 0)
+  if (collect_data == NULL)
     goto eos;
 
+  outsize = gst_buffer_get_size (collect_data->buffer);
   inbuf = gst_collect_pads_take_buffer (pads, collect_data, outsize);
   if (!inbuf)
     goto eos;
@@ -597,9 +608,6 @@ GST_START_TEST (test_collect_twice)
   /* now both pads have a buffer */
   fail_unless_collected (TRUE);
 
-  fail_unless (outbuf1 == buf1);
-  fail_unless (outbuf2 == buf2);
-
   /* these will return immediately as at this point the threads have been
    * unlocked and are finished */
   g_thread_join (thread1);
@@ -762,7 +770,7 @@ GST_START_TEST (test_branched_pipeline)
   gst_message_unref (msg);
 
   /* we have two branches, but we still only forward buffers from one branch */
-  fail_unless_equals_int (count, NUM_BUFFERS);
+  fail_unless_equals_int (count, NUM_BUFFERS * 2);
 
   gst_element_set_state (pipeline, GST_STATE_NULL);
   gst_object_unref (bus);