diff options
author | Vivia Nikolaidou <vivia@ahiru.eu> | 2020-04-10 19:54:31 +0300 |
---|---|---|
committer | GStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2020-04-15 09:07:24 +0000 |
commit | fecd38c8f6157d463fa83ffc94da8aaccc806fd4 (patch) | |
tree | ffb42dca9adb4c14b05cb99475010d2a45456fe9 /tests | |
parent | 97c05d3f4be168352799d1394c857b8bf005670b (diff) | |
download | gstreamer-plugins-bad-fecd38c8f6157d463fa83ffc94da8aaccc806fd4.tar.gz |
tsmux: Ability for streams to disappear and reappear
Until now, any streams in tsmux had to be present when the element
started its first buffer. Now they can appear at any point during the
stream, or even disappear and reappear later using the same PID.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check/elements/mpegtsmux.c | 74 |
1 files changed, 60 insertions, 14 deletions
diff --git a/tests/check/elements/mpegtsmux.c b/tests/check/elements/mpegtsmux.c index 2c8a4951c..3695434ce 100644 --- a/tests/check/elements/mpegtsmux.c +++ b/tests/check/elements/mpegtsmux.c @@ -148,30 +148,18 @@ cleanup_tsmux (GstElement * mux, const gchar * sinkname) } static void -check_tsmux_pad (GstStaticPadTemplate * srctemplate, +check_tsmux_pad_given_muxer (GstElement * mux, const gchar * src_caps_string, gint pes_id, gint pmt_id, - const gchar * sinkname, CheckOutputBuffersFunc check_func, guint n_bufs, - gssize input_buf_size, guint alignment) + CheckOutputBuffersFunc check_func, guint n_bufs, gssize input_buf_size) { GstClockTime ts; - GstElement *mux; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gint num_buffers; gint i; gint pmt_pid = -1, el_pid = -1, pcr_pid = -1, packets = 0; - gchar *padname; GstQuery *drain; - mux = setup_tsmux (srctemplate, sinkname, &padname); - - if (alignment != 0) - g_object_set (mux, "alignment", alignment, NULL); - - fail_unless (gst_element_set_state (mux, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - caps = gst_caps_from_string (src_caps_string); gst_check_setup_events (mysrcpad, mux, caps, GST_FORMAT_TIME); gst_caps_unref (caps); @@ -348,11 +336,68 @@ check_tsmux_pad (GstStaticPadTemplate * srctemplate, g_list_free (buffers); buffers = NULL; +} + +static void +check_tsmux_pad (GstStaticPadTemplate * srctemplate, + const gchar * src_caps_string, gint pes_id, gint pmt_id, + const gchar * sinkname, CheckOutputBuffersFunc check_func, guint n_bufs, + gssize input_buf_size, guint alignment) +{ + gchar *padname; + GstElement *mux; + + mux = setup_tsmux (srctemplate, sinkname, &padname); + + if (alignment != 0) + g_object_set (mux, "alignment", alignment, NULL); + + 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, src_caps_string, pes_id, pmt_id, + check_func, n_bufs, input_buf_size); cleanup_tsmux (mux, padname); g_free (padname); } +GST_START_TEST (test_reappearing_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"); + + check_tsmux_pad_given_muxer (mux, VIDEO_CAPS_STRING, 0xE0, 0x1b, NULL, 1, 1); + + pad = gst_element_get_static_pad (mux, padname); + gst_pad_set_active (mysrcpad, FALSE); + gst_object_unref (pad); + teardown_src_pad (mux, padname); + gst_element_release_request_pad (mux, pad); + g_free (padname); + + mysrcpad = setup_src_pad (mux, &video_src_template, "sink_%d", &padname); + gst_pad_set_active (mysrcpad, TRUE); + + 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_video) { @@ -491,6 +536,7 @@ 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); return s; } |