Fix funnel EOS handling and wrong unittest
authorSrimanta Panda <srimanta.panda@axis.com>
Mon, 16 Jun 2014 11:47:55 +0000 (13:47 +0200)
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>
Thu, 19 Jun 2014 14:19:15 +0000 (10:19 -0400)
When no data is coming from sinkpads and eos events
arrived at one of the sinkpad, funnel forwards the EOS
event to downstream. It forwards the EOS because lastsink pad
is NULL. Also the unit testcase of the funnel is not checking
the correct behavior as it should. The unit test case should
fail if one of the sink pad has already EOS present on it and
we are trying to push one more EOS.

https://bugzilla.gnome.org/show_bug.cgi?id=731716

plugins/elements/gstfunnel.c
tests/check/elements/funnel.c

index 272a908..a58ae72 100644 (file)
@@ -260,10 +260,13 @@ gst_funnel_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
     unlock = TRUE;
     GST_PAD_STREAM_LOCK (funnel->srcpad);
 
-    if ((GST_EVENT_TYPE (event) == GST_EVENT_EOS) &&
-        (!gst_funnel_all_sinkpads_eos_unlocked (funnel, pad))) {
-      forward = FALSE;
-    } else if (funnel->last_sinkpad && (pad != funnel->last_sinkpad)) {
+    if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
+      if (!gst_funnel_all_sinkpads_eos_unlocked (funnel, pad)) {
+        forward = FALSE;
+      } else {
+        forward = TRUE;
+      }
+    } else if (pad != funnel->last_sinkpad) {
       forward = FALSE;
     }
   }
index 4b47917..e5fe75f 100644 (file)
@@ -204,7 +204,7 @@ GST_START_TEST (test_funnel_eos)
               td.funnelsink11)));
 
   /* This will fail because everything is EOS already */
-  fail_unless (gst_pad_push_event (td.mysrc1, gst_event_new_eos ()));
+  fail_if (gst_pad_push_event (td.mysrc1, gst_event_new_eos ()));
   fail_unless (num_eos == 2);
 
   fail_unless (gst_pad_unlink (td.mysrc1, td.funnelsink11));
@@ -227,7 +227,7 @@ GST_START_TEST (test_funnel_eos)
 
   fail_unless (gst_pad_push_event (td.mysrc1, gst_event_new_eos ()));
   fail_unless (gst_pad_push_event (td.mysrc2, gst_event_new_eos ()));
-  fail_unless (num_eos == 2);
+  fail_unless (num_eos == 3);
 
   fail_unless (gst_pad_unlink (td.mysrc1, td.funnelsink11));
   gst_element_release_request_pad (td.funnel, td.funnelsink11);