mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-17 22:06:41 +00:00
qtmux: Test gaps at start of stream
https://bugzilla.gnome.org/show_bug.cgi?id=751242
This commit is contained in:
parent
7b8615d4fc
commit
89104e35bf
1 changed files with 88 additions and 2 deletions
|
@ -930,6 +930,10 @@ struct TestInputData
|
|||
* is used to vefity it */
|
||||
gint64 expected_segment_start;
|
||||
|
||||
GstClockTime expected_gap_ts;
|
||||
GstClockTime expected_gap_duration;
|
||||
gboolean gap_received;
|
||||
|
||||
GstPad *sinkpad;
|
||||
|
||||
GList *output_iter;
|
||||
|
@ -940,6 +944,9 @@ test_input_data_init (struct TestInputData *data)
|
|||
{
|
||||
data->ts_offset = 0;
|
||||
data->expected_segment_start = 0;
|
||||
data->expected_gap_ts = 0;
|
||||
data->expected_gap_duration = 0;
|
||||
data->gap_received = FALSE;
|
||||
data->srcpad = NULL;
|
||||
data->sinkpad = NULL;
|
||||
data->input = NULL;
|
||||
|
@ -1071,6 +1078,15 @@ _test_sink_pad_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
|||
test_data->output_iter = g_list_next (test_data->output_iter);
|
||||
break;
|
||||
}
|
||||
case GST_EVENT_GAP:{
|
||||
GstClockTime timestamp;
|
||||
GstClockTime duration;
|
||||
gst_event_parse_gap (event, ×tamp, &duration);
|
||||
fail_unless (timestamp == test_data->expected_gap_ts);
|
||||
fail_unless (duration == test_data->expected_gap_duration);
|
||||
test_data->gap_received = TRUE;
|
||||
break;
|
||||
}
|
||||
case GST_EVENT_TAG:
|
||||
/* ignore this event */
|
||||
break;
|
||||
|
@ -1426,8 +1442,9 @@ GST_START_TEST (test_muxing_dts_outside_segment)
|
|||
g_list_append (input1.input, create_buffer (3 * GST_SECOND,
|
||||
2 * GST_SECOND, GST_SECOND, 4096));
|
||||
input1.input = g_list_append (input1.input, gst_event_new_eos ());
|
||||
/* First DTS is 0, first PTS is 1s, so the output segment should
|
||||
* start from 1s to have the first running time == 0 */
|
||||
/* First DTS is 0, first PTS is 1s. The segment start being 1, this means
|
||||
* running time -1s and 0. So the output segment should start from 1s to keep
|
||||
* the same running time */
|
||||
input1.expected_segment_start = GST_SECOND;
|
||||
|
||||
input2.input = NULL;
|
||||
|
@ -1457,6 +1474,74 @@ GST_START_TEST (test_muxing_dts_outside_segment)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_muxing_initial_gap)
|
||||
{
|
||||
struct TestInputData input1, input2;
|
||||
GstCaps *caps;
|
||||
|
||||
test_input_data_init (&input1);
|
||||
test_input_data_init (&input2);
|
||||
|
||||
/* Create the inputs, after calling the run below, all this data is
|
||||
* transfered to it and we have no need to clean up */
|
||||
input1.input = NULL;
|
||||
input1.input =
|
||||
g_list_append (input1.input, gst_event_new_stream_start ("test-1"));
|
||||
caps = gst_caps_from_string
|
||||
("video/x-h264, width=(int)800, height=(int)600, "
|
||||
"framerate=(fraction)1/1, stream-format=(string)avc, codec_data=(buffer)0000,"
|
||||
" alignment=(string)au, level=(int)2, profile=(string)high");
|
||||
input1.input = g_list_append (input1.input, gst_event_new_caps (caps));
|
||||
gst_caps_unref (caps);
|
||||
gst_segment_init (&input1.segment, GST_FORMAT_TIME);
|
||||
input1.input =
|
||||
g_list_append (input1.input, gst_event_new_segment (&input1.segment));
|
||||
/* Duplicate the segment to please the harness */
|
||||
input1.input =
|
||||
g_list_append (input1.input, gst_event_new_segment (&input1.segment));
|
||||
input1.input =
|
||||
g_list_append (input1.input, create_buffer (1 * GST_SECOND,
|
||||
0, GST_SECOND, 4096));
|
||||
input1.input =
|
||||
g_list_append (input1.input, create_buffer (2 * GST_SECOND,
|
||||
1 * GST_SECOND, GST_SECOND, 4096));
|
||||
input1.input =
|
||||
g_list_append (input1.input, create_buffer (3 * GST_SECOND,
|
||||
2 * GST_SECOND, GST_SECOND, 4096));
|
||||
input1.input = g_list_append (input1.input, gst_event_new_eos ());
|
||||
|
||||
/* We expect a 1s gap at the start */
|
||||
input1.expected_gap_duration = GST_SECOND;
|
||||
|
||||
input2.input = NULL;
|
||||
input2.input =
|
||||
g_list_append (input2.input, gst_event_new_stream_start ("test-2"));
|
||||
caps = gst_caps_from_string
|
||||
("audio/mpeg, rate=(int)44100, channels=(int)1, mpegversion=(int)4, "
|
||||
"stream-format=(string)raw, framed=(boolean)true");
|
||||
input2.input = g_list_append (input2.input, gst_event_new_caps (caps));
|
||||
gst_caps_unref (caps);
|
||||
gst_segment_init (&input2.segment, GST_FORMAT_TIME);
|
||||
input2.input =
|
||||
g_list_append (input2.input, gst_event_new_segment (&input2.segment));
|
||||
input2.input =
|
||||
g_list_append (input2.input, create_buffer (0, 0, GST_SECOND,
|
||||
44100 * 4 * 2));
|
||||
input2.input =
|
||||
g_list_append (input2.input, create_buffer (GST_SECOND, GST_SECOND,
|
||||
GST_SECOND, 44100 * 4 * 2));
|
||||
input2.input =
|
||||
g_list_append (input2.input, create_buffer (2 * GST_SECOND,
|
||||
2 * GST_SECOND, GST_SECOND, 44100 * 4 * 2));
|
||||
input2.input = g_list_append (input2.input, gst_event_new_eos ());
|
||||
|
||||
run_muxing_test (&input1, &input2);
|
||||
|
||||
fail_unless (input1.gap_received);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
static Suite *
|
||||
qtmux_suite (void)
|
||||
{
|
||||
|
@ -1498,6 +1583,7 @@ qtmux_suite (void)
|
|||
tcase_add_test (tc_chain, test_muxing_non_zero_segment);
|
||||
tcase_add_test (tc_chain, test_muxing_non_zero_segment_different);
|
||||
tcase_add_test (tc_chain, test_muxing_dts_outside_segment);
|
||||
tcase_add_test (tc_chain, test_muxing_initial_gap);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue