tests: mpegtsmux: Test we don't crash releasing unused pad

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1411>
This commit is contained in:
Jan Alexander Steffens (heftig) 2020-07-07 14:02:06 +02:00
parent 076189e2dc
commit 9c2982d22c

View file

@ -388,6 +388,38 @@ GST_START_TEST (test_reappearing_pad)
GST_END_TEST;
GST_START_TEST (test_unused_pad)
{
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");
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);
cleanup_tsmux (mux, padname);
g_free (padname);
}
GST_END_TEST;
GST_START_TEST (test_video)
{
check_tsmux_pad (&video_src_template, VIDEO_CAPS_STRING, 0xE0, 0x1b,
@ -526,6 +558,7 @@ mpegtsmux_suite (void)
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_unused_pad);
return s;
}