rtpjitterbuffer: add another test

The test is modified slightly because the late lost packets are only
generated now when a large gap is received.
This commit is contained in:
Wim Taymans 2013-09-18 14:23:55 +02:00
parent 5d5fc03e04
commit 5c1f2f0045

View file

@ -780,7 +780,6 @@ GST_START_TEST (test_late_packets_still_makes_lost_events)
GST_END_TEST;
#if 0
GST_START_TEST (test_all_packets_are_timestamped_zero)
{
TestData data;
@ -789,8 +788,8 @@ GST_START_TEST (test_all_packets_are_timestamped_zero)
GstBuffer *in_buf, *out_buf;
GstEvent *out_event;
gint jb_latency_ms = 10;
GstClockTime buffer_time;
gint b;
GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
setup_testharness (&data);
timeout = 20 * G_USEC_PER_SEC;
@ -803,10 +802,9 @@ GST_START_TEST (test_all_packets_are_timestamped_zero)
in_buf = generate_test_buffer (0 * GST_MSECOND, TRUE, 0, 0);
g_assert_cmpint (gst_pad_push (data.test_src_pad, in_buf), ==, GST_FLOW_OK);
g_assert (gst_test_clock_wait_for_next_pending_id (GST_TEST_CLOCK
(data.clock), &id));
gst_test_clock_wait_for_next_pending_id (GST_TEST_CLOCK (data.clock), &id);
g_assert (gst_test_clock_process_next_clock_id (GST_TEST_CLOCK (data.clock))
== id.clock_id);
== id);
out_buf = g_async_queue_timeout_pop (data.buf_queue, timeout);
g_assert (out_buf != NULL);
@ -826,32 +824,32 @@ GST_START_TEST (test_all_packets_are_timestamped_zero)
in_buf = generate_test_buffer (0, TRUE, b, 0);
g_assert_cmpint (gst_pad_push (data.test_src_pad, in_buf), ==, GST_FLOW_OK);
// release the wait
g_assert (gst_test_clock_wait_for_next_pending_id (GST_TEST_CLOCK
(data.clock), &id));
g_assert (gst_test_clock_process_next_clock_id (GST_TEST_CLOCK (data.clock))
== id.clock_id);
// we should now receive a packet-lost-event for buffer 3 and 4
out_event = g_async_queue_timeout_pop (data.event_queue, timeout);
g_assert (out_event != NULL);
g_assert_cmpint (data.lost_event_count, ==, 1);
verify_lost_event (out_event, 3, 0, 0, TRUE);
verify_lost_event (out_event, 3, 0, 0, FALSE);
out_event = g_async_queue_timeout_pop (data.event_queue, timeout);
g_assert (out_event != NULL);
verify_lost_event (out_event, 4, 0, 0, FALSE);
g_assert_cmpint (data.lost_event_count, ==, 2);
// verify that buffer 5 made it through!
out_buf = g_async_queue_timeout_pop (data.buf_queue, timeout);
g_assert (out_buf != NULL);
g_assert (GST_BUFFER_FLAG_IS_SET (out_buf, GST_BUFFER_FLAG_DISCONT));
g_assert_cmpint (gst_rtp_buffer_get_seq (out_buf), ==, 5);
gst_rtp_buffer_map (out_buf, GST_MAP_READ, &rtp);
g_assert_cmpint (gst_rtp_buffer_get_seq (&rtp), ==, 5);
gst_rtp_buffer_unmap (&rtp);
// should still have only seen 1 packet lost event
g_assert_cmpint (data.lost_event_count, ==, 1);
g_assert_cmpint (data.lost_event_count, ==, 2);
destroy_testharness (&data);
}
GST_END_TEST;
#endif
static Suite *
rtpjitterbuffer_suite (void)
@ -867,9 +865,7 @@ rtpjitterbuffer_suite (void)
tcase_add_test (tc_chain, test_only_one_lost_event_on_large_gaps);
tcase_add_test (tc_chain, test_two_lost_one_arrives_in_time);
tcase_add_test (tc_chain, test_late_packets_still_makes_lost_events);
#if 0
tcase_add_test (tc_chain, test_all_packets_are_timestamped_zero);
#endif
/* FIXME: test buffer lists */