Fix funnel EOS handling and wrong unittest

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
This commit is contained in:
Srimanta Panda 2014-06-16 13:47:55 +02:00 committed by Olivier Crête
parent bc75a166f0
commit 5b3ee70ea9
2 changed files with 9 additions and 6 deletions

View 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;
}
}

View 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);