mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
mpegtsdemux: tests: Test that tsparse doesn't drop padding
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1300>
This commit is contained in:
parent
23a2916afd
commit
aad9cf8096
1 changed files with 74 additions and 0 deletions
|
@ -130,6 +130,28 @@ static const guint8 aac_data[] = {
|
||||||
0xff, 0xf1, 0x50, 0x40, 0x01, 0x7f, 0xfc, 0x01, 0x18, 0x20, 0x07
|
0xff, 0xf1, 0x50, 0x40, 0x01, 0x7f, 0xfc, 0x01, 0x18, 0x20, 0x07
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Padding packet */
|
||||||
|
static const guint8 padding_ts[] = {
|
||||||
|
0x47, 0x1f, 0xff, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
};
|
||||||
|
|
||||||
|
G_STATIC_ASSERT (sizeof padding_ts == PACKETSIZE);
|
||||||
|
|
||||||
GST_START_TEST (test_tsparse_simple)
|
GST_START_TEST (test_tsparse_simple)
|
||||||
{
|
{
|
||||||
GstHarness *h = gst_harness_new ("tsparse");
|
GstHarness *h = gst_harness_new ("tsparse");
|
||||||
|
@ -262,6 +284,57 @@ GST_START_TEST (test_tsparse_align_split)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
|
GST_START_TEST (test_tsparse_padding)
|
||||||
|
{
|
||||||
|
GstHarness *h = gst_harness_new ("tsparse");
|
||||||
|
GstBuffer *buf, *padding;
|
||||||
|
|
||||||
|
gst_harness_set_src_caps_str (h, "video/mpegts,systemstream=true");
|
||||||
|
gst_harness_set_sink_caps_str (h,
|
||||||
|
"video/mpegts,systemstream=true,packetsize=" G_STRINGIFY (PACKETSIZE));
|
||||||
|
|
||||||
|
buf =
|
||||||
|
gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY, (guint8 *) aac_ts,
|
||||||
|
sizeof aac_ts, 0, sizeof aac_ts, NULL, NULL);
|
||||||
|
padding =
|
||||||
|
gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY,
|
||||||
|
(guint8 *) padding_ts, sizeof padding_ts, 0, sizeof padding_ts, NULL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
fail_unless (gst_harness_push (h, gst_buffer_ref (buf)) == GST_FLOW_OK);
|
||||||
|
fail_unless (gst_harness_push (h, gst_buffer_ref (padding)) == GST_FLOW_OK);
|
||||||
|
fail_unless (gst_harness_push (h, buf) == GST_FLOW_OK);
|
||||||
|
fail_unless (gst_harness_push (h, gst_buffer_ref (padding)) == GST_FLOW_OK);
|
||||||
|
fail_unless (gst_harness_push (h, padding) == GST_FLOW_OK);
|
||||||
|
|
||||||
|
buf = gst_harness_pull (h);
|
||||||
|
gst_check_buffer_data (buf, aac_ts, sizeof aac_ts);
|
||||||
|
gst_buffer_unref (buf);
|
||||||
|
|
||||||
|
padding = gst_harness_pull (h);
|
||||||
|
gst_check_buffer_data (padding, padding_ts, sizeof padding_ts);
|
||||||
|
gst_buffer_unref (padding);
|
||||||
|
|
||||||
|
buf = gst_harness_pull (h);
|
||||||
|
gst_check_buffer_data (buf, aac_ts, sizeof aac_ts);
|
||||||
|
gst_buffer_unref (buf);
|
||||||
|
|
||||||
|
padding = gst_harness_pull (h);
|
||||||
|
gst_check_buffer_data (padding, padding_ts, sizeof padding_ts);
|
||||||
|
gst_buffer_unref (padding);
|
||||||
|
|
||||||
|
padding = gst_harness_pull (h);
|
||||||
|
gst_check_buffer_data (padding, padding_ts, sizeof padding_ts);
|
||||||
|
gst_buffer_unref (padding);
|
||||||
|
|
||||||
|
gst_harness_push_event (h, gst_event_new_eos ());
|
||||||
|
fail_unless (gst_harness_buffers_in_queue (h) == 0);
|
||||||
|
|
||||||
|
gst_harness_teardown (h);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tsdemux_simple_pad_added (GstElement * tsdemux, GstPad * pad, GstHarness * h)
|
tsdemux_simple_pad_added (GstElement * tsdemux, GstPad * pad, GstHarness * h)
|
||||||
{
|
{
|
||||||
|
@ -316,6 +389,7 @@ mpegtsdemux_suite (void)
|
||||||
tcase_skip_broken_test (tc, test_tsparse_align_auto);
|
tcase_skip_broken_test (tc, test_tsparse_align_auto);
|
||||||
tcase_add_test (tc, test_tsparse_align_fuse);
|
tcase_add_test (tc, test_tsparse_align_fuse);
|
||||||
tcase_add_test (tc, test_tsparse_align_split);
|
tcase_add_test (tc, test_tsparse_align_split);
|
||||||
|
tcase_add_test (tc, test_tsparse_padding);
|
||||||
|
|
||||||
tc = tcase_create ("tsdemux");
|
tc = tcase_create ("tsdemux");
|
||||||
suite_add_tcase (s, tc);
|
suite_add_tcase (s, tc);
|
||||||
|
|
Loading…
Reference in a new issue