From 791711f9becc96c196437c724d27ef907a4ff91c Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Wed, 9 Jan 2019 15:59:16 +0100 Subject: [PATCH] test: rtph264pay: Verify we only mark the last fragment --- tests/check/elements/rtph264.c | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tests/check/elements/rtph264.c b/tests/check/elements/rtph264.c index e5015ad458..3fab42bc98 100644 --- a/tests/check/elements/rtph264.c +++ b/tests/check/elements/rtph264.c @@ -642,6 +642,47 @@ GST_START_TEST (test_rtph264pay_marker_for_au) GST_END_TEST; +GST_START_TEST (test_rtph264pay_marker_for_fragmented_au) +{ + GstHarness *h = + gst_harness_new_parse ("rtph264pay timestamp-offset=123 mtu=40"); + GstFlowReturn ret; + GstBuffer *slice1, *slice2, *buffer; + GstRTPBuffer rtp = GST_RTP_BUFFER_INIT; + gint i; + + gst_harness_set_src_caps_str (h, + "video/x-h264,alignment=au,stream-format=byte-stream"); + + slice1 = wrap_static_buffer (h264_idr_slice_1, sizeof (h264_idr_slice_1)); + slice2 = wrap_static_buffer (h264_idr_slice_2, sizeof (h264_idr_slice_2)); + buffer = gst_buffer_append (slice1, slice2); + + ret = gst_harness_push (h, buffer); + fail_unless_equals_int (ret, GST_FLOW_OK); + + fail_unless_equals_int (gst_harness_buffers_in_queue (h), 4); + + for (i = 0; i < 3; i++) { + buffer = gst_harness_pull (h); + fail_unless (gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtp)); + fail_if (gst_rtp_buffer_get_marker (&rtp)); + gst_rtp_buffer_unmap (&rtp); + gst_buffer_unref (buffer); + } + + buffer = gst_harness_pull (h); + fail_unless (gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtp)); + fail_unless (gst_rtp_buffer_get_marker (&rtp)); + gst_rtp_buffer_unmap (&rtp); + gst_buffer_unref (buffer); + + gst_harness_teardown (h); +} + +GST_END_TEST; + + static Suite * rtph264_suite (void) { @@ -660,6 +701,7 @@ rtph264_suite (void) tcase_add_test (tc_chain, test_rtph264pay_two_slices_timestamp); tcase_add_test (tc_chain, test_rtph264pay_marker_for_flag); tcase_add_test (tc_chain, test_rtph264pay_marker_for_au); + tcase_add_test (tc_chain, test_rtph264pay_marker_for_fragmented_au); return s; }