summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2015-03-20 07:23:53 -0300
committerThiago Santos <thiagoss@osg.samsung.com>2015-03-20 07:42:11 -0300
commit9cee81dc1b812e7a42e49495e2da88a304e47df1 (patch)
tree7fd021e37888bcbcb71bfeddea8b8c4c0bf71432
parent9a98605e251883dfe7f37abfeb18b7a6832ac2a8 (diff)
tests: input-selector: verify that eos from unselected pads block
Adds a test that creates 2 inputs for input-selector, one of which is an empty stream (just pushes an EOS event) while the other has 1 buffer before EOS. The selected stream is the one that has the buffer. input-selector should block the EOS on the unselected pad and forward the buffer on the other one before forwarding the EOS (once all pads are EOS) https://bugzilla.gnome.org/show_bug.cgi?id=746518
-rw-r--r--tests/check/elements/selector.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/check/elements/selector.c b/tests/check/elements/selector.c
index 12f5f47cd..224d185fa 100644
--- a/tests/check/elements/selector.c
+++ b/tests/check/elements/selector.c
@@ -396,6 +396,53 @@ GST_START_TEST (test_input_selector_buffer_count)
GST_END_TEST;
+GST_START_TEST (test_input_selector_empty_stream)
+{
+ GstElement *sel = gst_check_setup_element ("input-selector");
+ GstPad *output_pad = gst_check_setup_sink_pad (sel, &sinktemplate);
+ GstPad *empty_stream_pad;
+ GstPad *stream_pad;
+ GstEvent *eos_event;
+
+ gst_pad_set_active (output_pad, TRUE);
+ stream_pad = setup_input_pad (sel);
+ empty_stream_pad = setup_input_pad (sel);
+
+ g_object_set (sel, "active-pad", GST_PAD_PEER (stream_pad), NULL);
+
+ /* run the test */
+ fail_unless (gst_element_set_state (sel,
+ GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
+ "could not set to playing");
+
+ gst_check_setup_events_with_stream_id (empty_stream_pad, sel, NULL,
+ GST_FORMAT_TIME, "empty-stream-id");
+ gst_check_setup_events_with_stream_id (stream_pad, sel, NULL,
+ GST_FORMAT_TIME, "stream-id");
+
+ /* empty stream is just an EOS and it should not be forwarded */
+ fail_unless (gst_pad_push_event (empty_stream_pad, gst_event_new_eos ()));
+ fail_unless (gst_pad_get_sticky_event (output_pad, GST_EVENT_EOS, 0) == NULL);
+
+ fail_unless (buffers == NULL);
+ fail_unless (gst_pad_push (stream_pad, gst_buffer_new ()) == GST_FLOW_OK);
+ fail_unless (buffers != NULL);
+ fail_unless (gst_pad_push_event (stream_pad, gst_event_new_eos ()));
+ eos_event = gst_pad_get_sticky_event (output_pad, GST_EVENT_EOS, 0);
+ fail_unless (eos_event != NULL);
+ gst_event_unref (eos_event);
+
+ fail_unless (gst_element_set_state (sel,
+ GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
+
+ /* clean up */
+ gst_pad_set_active (output_pad, FALSE);
+ gst_check_teardown_sink_pad (sel);
+ gst_check_teardown_element (sel);
+}
+
+GST_END_TEST;
+
GST_START_TEST (test_output_selector_no_srcpad_negotiation)
{
@@ -605,6 +652,7 @@ selector_suite (void)
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_output_selector_buffer_count);
tcase_add_test (tc_chain, test_input_selector_buffer_count);
+ tcase_add_test (tc_chain, test_input_selector_empty_stream);
tcase_add_test (tc_chain, test_output_selector_no_srcpad_negotiation);
tc_chain = tcase_create ("output-selector-negotiation");