Commit e6d18896 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller
Browse files

tests: fix indentation

parent 567afdd4
......@@ -336,7 +336,7 @@ GST_START_TEST (test_speex_streamable)
GST_END_TEST;
static void
check_buf_type_timestamp (GstBuffer *buf, gint packet_type, gint timestamp)
check_buf_type_timestamp (GstBuffer * buf, gint packet_type, gint timestamp)
{
GstMapInfo map = GST_MAP_INFO_INIT;
gst_buffer_map (buf, &map, GST_MAP_READ);
......@@ -346,7 +346,7 @@ check_buf_type_timestamp (GstBuffer *buf, gint packet_type, gint timestamp)
gst_buffer_unref (buf);
}
GST_START_TEST(test_increasing_timestamp_when_pts_none)
GST_START_TEST (test_increasing_timestamp_when_pts_none)
{
const gint AUDIO = 0x08;
const gint VIDEO = 0x09;
......@@ -376,29 +376,26 @@ GST_START_TEST(test_increasing_timestamp_when_pts_none)
gst_pad_link (video_src, video_sink);
audio_caps = gst_caps_new_simple ("audio/x-speex",
"rate", G_TYPE_INT, 16000,
"channels", G_TYPE_INT, 1,
NULL);
"rate", G_TYPE_INT, 16000, "channels", G_TYPE_INT, 1, NULL);
gst_harness_set_src_caps (audio_q, audio_caps);
video_caps = gst_caps_new_simple ("video/x-h264",
"stream-format", G_TYPE_STRING, "avc",
NULL);
"stream-format", G_TYPE_STRING, "avc", NULL);
gst_harness_set_src_caps (video_q, video_caps);
/* Push audio + video + audio with increasing DTS, but PTS for video is
* GST_CLOCK_TIME_NONE
*/
buf = gst_buffer_new();
buf = gst_buffer_new ();
GST_BUFFER_DTS (buf) = timestamp * GST_MSECOND + base_time;
GST_BUFFER_PTS (buf) = timestamp * GST_MSECOND + base_time;
gst_harness_push (audio_q, buf);
buf = gst_buffer_new();
buf = gst_buffer_new ();
GST_BUFFER_DTS (buf) = (timestamp + 1) * GST_MSECOND + base_time;
GST_BUFFER_PTS (buf) = GST_CLOCK_TIME_NONE;
gst_harness_push (video_q, buf);
buf = gst_buffer_new();
buf = gst_buffer_new ();
GST_BUFFER_DTS (buf) = (timestamp + 2) * GST_MSECOND + base_time;
GST_BUFFER_PTS (buf) = (timestamp + 2) * GST_MSECOND + base_time;
gst_harness_push (audio_q, buf);
......@@ -422,6 +419,7 @@ GST_START_TEST(test_increasing_timestamp_when_pts_none)
gst_harness_teardown (audio_q);
gst_harness_teardown (video_q);
}
GST_END_TEST;
static Suite *
......
......@@ -133,9 +133,10 @@ GST_START_TEST (test_h263pay_mode_b_snow)
if (!have_element ("avenc_h263"))
return;
h = gst_harness_new_parse (
"avenc_h263 rtp-payload-size=1 ! rtph263pay mtu=1350 ");
gst_harness_add_src_parse (h, "videotestsrc pattern=snow is-live=1 ! "
h = gst_harness_new_parse
("avenc_h263 rtp-payload-size=1 ! rtph263pay mtu=1350 ");
gst_harness_add_src_parse (h,
"videotestsrc pattern=snow is-live=1 ! "
"capsfilter caps=\"video/x-raw,format=I420,width=176,height=144\"", TRUE);
for (i = 0; i < frames; i++)
......@@ -144,6 +145,7 @@ GST_START_TEST (test_h263pay_mode_b_snow)
gst_harness_teardown (h);
}
GST_END_TEST;
/* gst_rtp_buffer_get_payload() may return a copy of the payload. This test
......@@ -155,11 +157,14 @@ GST_START_TEST (test_h263pdepay_fragmented_memory_non_writable_buffer)
GstBuffer *header_buf, *payload_buf, *buf;
GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
guint8 header[] = {
0x04, 0x00 };
0x04, 0x00
};
guint8 payload[] = {
0x80, 0x02, 0x1c, 0xb8, 0x01, 0x00, 0x11, 0xe0, 0x44, 0xc4 };
0x80, 0x02, 0x1c, 0xb8, 0x01, 0x00, 0x11, 0xe0, 0x44, 0xc4
};
guint8 frame[] = {
0x00, 0x00, 0x80, 0x02, 0x1c, 0xb8, 0x01, 0x00, 0x11, 0xe0, 0x44, 0xc4 };
0x00, 0x00, 0x80, 0x02, 0x1c, 0xb8, 0x01, 0x00, 0x11, 0xe0, 0x44, 0xc4
};
h = gst_harness_new ("rtph263pdepay");
gst_harness_set_src_caps_str (h, "application/x-rtp, media=video, "
......@@ -185,22 +190,26 @@ GST_START_TEST (test_h263pdepay_fragmented_memory_non_writable_buffer)
gst_harness_teardown (h);
}
GST_END_TEST;
/* gst_rtp_buffer_get_payload() may return a copy of the payload. This test
* makes sure that the rtph263pdepay also produces the correct output in this
* case. */
GST_START_TEST (test_h263pdepay_fragmented_memory_non_writable_buffer_split_frame)
{
GST_START_TEST
(test_h263pdepay_fragmented_memory_non_writable_buffer_split_frame) {
GstHarness *h;
GstBuffer *header_buf, *payload_buf, *buf;
GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
guint8 header[] = {
0x04, 0x00 };
0x04, 0x00
};
guint8 payload[] = {
0x80, 0x02, 0x1c, 0xb8, 0x01, 0x00, 0x11, 0xe0, 0x44, 0xc4 };
0x80, 0x02, 0x1c, 0xb8, 0x01, 0x00, 0x11, 0xe0, 0x44, 0xc4
};
guint8 frame[] = {
0x00, 0x00, 0x80, 0x02, 0x1c, 0xb8, 0x01, 0x00, 0x11, 0xe0, 0x44, 0xc4 };
0x00, 0x00, 0x80, 0x02, 0x1c, 0xb8, 0x01, 0x00, 0x11, 0xe0, 0x44, 0xc4
};
h = gst_harness_new ("rtph263pdepay");
gst_harness_set_src_caps_str (h, "application/x-rtp, media=video, "
......@@ -244,6 +253,7 @@ GST_START_TEST (test_h263pdepay_fragmented_memory_non_writable_buffer_split_fram
gst_harness_teardown (h);
}
GST_END_TEST;
GST_START_TEST (test_h263pdepay_dont_push_empty_frame)
......@@ -271,6 +281,7 @@ GST_START_TEST (test_h263pdepay_dont_push_empty_frame)
gst_harness_teardown (h);
}
GST_END_TEST;
static Suite *
......@@ -288,8 +299,10 @@ rtph263_suite (void)
tcase_add_test (tc_chain, test_h263pay_mode_b_snow);
suite_add_tcase (s, (tc_chain = tcase_create ("h263pdepay")));
tcase_add_test (tc_chain, test_h263pdepay_fragmented_memory_non_writable_buffer);
tcase_add_test (tc_chain, test_h263pdepay_fragmented_memory_non_writable_buffer_split_frame);
tcase_add_test (tc_chain,
test_h263pdepay_fragmented_memory_non_writable_buffer);
tcase_add_test (tc_chain,
test_h263pdepay_fragmented_memory_non_writable_buffer_split_frame);
tcase_add_test (tc_chain, test_h263pdepay_dont_push_empty_frame);
return s;
......
......@@ -1158,16 +1158,16 @@ GST_START_TEST (test_rtx_two_missing)
/*
The expected sequence of buffers is this:
____ ____ ____ ____
____ ____ ____ ____
... | 10 | | 11 | | 12 | | 13 |
–––– –––– –––– ––––
200ms 220ms 240ms 260ms
–––– –––– –––– ––––
200ms 220ms 240ms 260ms
But instead we get this:
____ _ _ _ _ ____
____ _ _ _ _ ____
... | 10 | | | | | | 13 |
–––– - - - - ––––
200ms 260ms
–––– - - - - ––––
200ms 260ms
Now it is important to note that the next thing that happens is that
the RTX timeout for packet 11 will happen at time 230ms, so we crank
......@@ -1193,18 +1193,18 @@ GST_START_TEST (test_rtx_two_missing)
/*
This will estimate the dts on the two missing packets to:
____ ____
____ ____
... | 11 | | 12 | ...
–––– ––––
220ms 240ms
–––– ––––
220ms 240ms
And given their regular interspacing of 20ms, it will schedule two RTX
timers for them like so:
____ ____
____ ____
... | 11 | | 12 | ...
–––– ––––
230ms 250ms
–––– ––––
230ms 250ms
There are however two problems, packet 11 we have already sent one RTX for
and its timeout is currently at 270ms, so we should not tamper with that,
......@@ -1259,16 +1259,16 @@ GST_START_TEST (text_rtx_two_missing_early)
/*
The expected sequence of buffers is this:
___ ___ ___ ___ ___
___ ___ ___ ___ ___
| 0 | | 1 | | 2 | | 3 | | 4 |
––– ––– ––– ––– –––
0ms 20ms 40ms 60ms 80ms
––– ––– ––– ––– –––
0ms 20ms 40ms 60ms 80ms
But instead we get this:
___ ___ _ _ _ _ ___
___ ___ _ _ _ _ ___
| 0 | | 1 | | | | | | 4 |
––– ––– – – – – –––
0ms 20ms 41ms
––– ––– – – – – –––
0ms 20ms 41ms
*/
......@@ -1282,26 +1282,26 @@ GST_START_TEST (text_rtx_two_missing_early)
With the now calculated packet-spacing of (41-20) / 3 = 7,
giving us these expected times:
___ ___ ___ ___ ___
___ ___ ___ ___ ___
| 0 | | 1 | | 2 | | 3 | | 4 |
––– ––– ––– ––– –––
0ms 20ms 27ms 34ms 41ms
––– ––– ––– ––– –––
0ms 20ms 27ms 34ms 41ms
For RTX, the inital RTX-timeouts for the missing buffers are
the expected arrival time + half the packet-spacing time, like this:
___ ___
___ ___
| 2 | | 3 |
––– –––
50ms 70ms
––– –––
50ms 70ms
But since we have re-calculated the estimated arrival-time
of these buffers, we have to adjust the RTX timeout as well,
and we use the original delay (packet-spacing / 2) = 10ms,
and add it on:
___ ___
___ ___
| 2 | | 3 |
––– –––
37ms 44ms
––– –––
37ms 44ms
Also note that the first RTX request is now scheduled for a
time that is prior to NOW (37ms < 41ms), so it will be sent straight
......@@ -1796,7 +1796,8 @@ GST_START_TEST (test_rtx_duplicate_packet_updates_rtx_stats)
"rtx-per-packet", G_TYPE_DOUBLE, 1.0,
"rtx-rtt", G_TYPE_UINT64, (guint64)
/* Use the rtx-rtt formula. Can be subject to change though. */
((now - rtx_request_6) + 47 * (now - rtx_request_7)) / 48, NULL)));
((now - rtx_request_6) + 47 * (now - rtx_request_7)) / 48,
NULL)));
gst_object_unref (testclock);
gst_harness_teardown (h);
......@@ -2490,7 +2491,8 @@ rtpjitterbuffer_suite (void)
tcase_add_loop_test (tc_chain, test_num_late_when_considered_lost_arrives, 0,
2);
tcase_add_test (tc_chain, test_reorder_of_non_equidistant_packets);
tcase_add_test (tc_chain, test_loss_equidistant_spacing_with_parameter_packets);
tcase_add_test (tc_chain,
test_loss_equidistant_spacing_with_parameter_packets);
tcase_add_test (tc_chain, test_rtx_expected_next);
tcase_add_test (tc_chain, test_rtx_two_missing);
......@@ -2500,7 +2502,8 @@ rtpjitterbuffer_suite (void)
tcase_add_test (tc_chain, test_rtx_buffer_arrives_too_late);
tcase_add_test (tc_chain, test_rtx_original_buffer_does_not_update_rtx_stats);
tcase_add_test (tc_chain, test_rtx_duplicate_packet_updates_rtx_stats);
tcase_add_test (tc_chain, test_rtx_buffer_arrives_after_lost_updates_rtx_stats);
tcase_add_test (tc_chain,
test_rtx_buffer_arrives_after_lost_updates_rtx_stats);
tcase_add_test (tc_chain, test_rtx_rtt_larger_than_retry_timeout);
tcase_add_test (tc_chain, test_rtx_no_request_if_time_past_retry_period);
......
......@@ -669,25 +669,27 @@ stats_test_cb (GObject * object, GParamSpec * spec, gpointer data)
*cb_called = TRUE;
/* We should be able to get a rtpsession property
without introducing the deadlock */
without introducing the deadlock */
g_object_get (object, "num-sources", &num_sources, NULL);
}
GST_START_TEST (test_dont_lock_on_stats)
{
GstHarness * h_rtcp;
GstHarness * h_send;
GstClock * clock = gst_test_clock_new ();
GstTestClock * testclock = GST_TEST_CLOCK (clock);
GstHarness *h_rtcp;
GstHarness *h_send;
GstClock *clock = gst_test_clock_new ();
GstTestClock *testclock = GST_TEST_CLOCK (clock);
gboolean cb_called = FALSE;
/* use testclock as the systemclock to capture the rtcp thread waits */
gst_system_clock_set_default (GST_CLOCK (testclock));
h_rtcp = gst_harness_new_with_padnames (
"rtpsession", "recv_rtcp_sink", "send_rtcp_src");
h_send = gst_harness_new_with_element (
h_rtcp->element, "send_rtp_sink", "send_rtp_src");
h_rtcp =
gst_harness_new_with_padnames ("rtpsession", "recv_rtcp_sink",
"send_rtcp_src");
h_send =
gst_harness_new_with_element (h_rtcp->element, "send_rtp_sink",
"send_rtp_src");
/* connect to the stats-reporting */
g_signal_connect (h_rtcp->element, "notify::stats",
......@@ -702,6 +704,7 @@ GST_START_TEST (test_dont_lock_on_stats)
gst_harness_teardown (h_rtcp);
gst_object_unref (clock);
}
GST_END_TEST;
static void
......
......@@ -93,6 +93,7 @@ GST_START_TEST (test_depay_non_flexible_mode)
gst_harness_teardown (h);
}
GST_END_TEST;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment