tests: mpegtsmux: Test that we can manipulate pads after stop

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1552>
This commit is contained in:
Jan Alexander Steffens (heftig) 2020-09-01 15:05:07 +02:00 committed by GStreamer Merge Bot
parent ef8142ef90
commit ebe397892b

View file

@ -352,7 +352,7 @@ check_tsmux_pad (GstStaticPadTemplate * srctemplate,
g_free (padname);
}
GST_START_TEST (test_reappearing_pad)
GST_START_TEST (test_reappearing_pad_while_playing)
{
gchar *padname;
GstElement *mux;
@ -388,6 +388,48 @@ GST_START_TEST (test_reappearing_pad)
GST_END_TEST;
GST_START_TEST (test_reappearing_pad_while_stopped)
{
gchar *padname;
GstElement *mux;
GstPad *pad;
mux = gst_check_setup_element ("mpegtsmux");
mysrcpad = setup_src_pad (mux, &video_src_template, "sink_%d", &padname);
mysinkpad = gst_check_setup_sink_pad (mux, &sink_template);
gst_pad_set_active (mysrcpad, TRUE);
gst_pad_set_active (mysinkpad, TRUE);
fail_unless (gst_element_set_state (mux,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
check_tsmux_pad_given_muxer (mux, VIDEO_CAPS_STRING, 0xE0, 0x1b, NULL, 1, 1);
gst_element_set_state (mux, GST_STATE_NULL);
pad = gst_element_get_static_pad (mux, padname);
gst_pad_set_active (mysrcpad, FALSE);
teardown_src_pad (mux, padname);
gst_element_release_request_pad (mux, pad);
gst_object_unref (pad);
g_free (padname);
mysrcpad = setup_src_pad (mux, &video_src_template, "sink_%d", &padname);
gst_pad_set_active (mysrcpad, TRUE);
fail_unless (gst_element_set_state (mux,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
check_tsmux_pad_given_muxer (mux, VIDEO_CAPS_STRING, 0xE0, 0x1b, NULL, 1, 1);
cleanup_tsmux (mux, padname);
g_free (padname);
}
GST_END_TEST;
GST_START_TEST (test_unused_pad)
{
gchar *padname;
@ -557,7 +599,8 @@ mpegtsmux_suite (void)
tcase_add_test (tc_chain, test_multiple_state_change);
tcase_add_test (tc_chain, test_align);
tcase_add_test (tc_chain, test_keyframe_flag_propagation);
tcase_add_test (tc_chain, test_reappearing_pad);
tcase_add_test (tc_chain, test_reappearing_pad_while_playing);
tcase_add_test (tc_chain, test_reappearing_pad_while_stopped);
tcase_add_test (tc_chain, test_unused_pad);
return s;