summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStian Selnes <stian@pexip.com>2016-07-26 18:01:48 +0200
committerOlivier CrĂȘte <olivier.crete@collabora.com>2016-09-14 19:37:50 -0400
commitab49dfd0b209a5dec10ce9cc8b84ae86dc1e8779 (patch)
treed75804ea82bac684b7be1dda2e6c76c6281b9519 /tests
parentdd020f5cc8021bffb10b4e7835850600090a2540 (diff)
downloadgstreamer-plugins-good-ab49dfd0b209a5dec10ce9cc8b84ae86dc1e8779.tar.gz
rtpjitterbuffer: Fix lost duration when gap after lost timer
This patch fixes an issue with the estimated gap duration when there is a gap immediately after a lost timer has been processed. Previously there was a discrepancy beteen the gap in seqnum and gap in dts which would cause wrong calculated duration. The issue would only be seen with retranmission enabled since when it's disabled lost timers are only created when a packet is received and the actual gap length and last dts is known. https://bugzilla.gnome.org/show_bug.cgi?id=769768
Diffstat (limited to 'tests')
-rw-r--r--tests/check/elements/rtpjitterbuffer.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/tests/check/elements/rtpjitterbuffer.c b/tests/check/elements/rtpjitterbuffer.c
index b2a73ba45..5969d12a9 100644
--- a/tests/check/elements/rtpjitterbuffer.c
+++ b/tests/check/elements/rtpjitterbuffer.c
@@ -1875,8 +1875,6 @@ GST_START_TEST (test_gap_exceeds_latency)
GstTestClock *testclock;
const gint jb_latency_ms = 200;
- guint32 timestamp_ms = 0;
- guint32 rtp_ts = 0;
gint i;
GstEvent *out_event;
GstBuffer *out_buf;
@@ -1893,10 +1891,7 @@ GST_START_TEST (test_gap_exceeds_latency)
fail_unless_equals_int (GST_FLOW_OK,
gst_harness_push (h, generate_test_buffer (0)));
- timestamp_ms += 20;
- rtp_ts += PCMU_RTP_TS_DURATION;
- gst_harness_set_time (h, timestamp_ms * GST_MSECOND);
-
+ gst_harness_set_time (h, 1 * PCMU_BUF_DURATION);
fail_unless_equals_int (GST_FLOW_OK,
gst_harness_push (h, generate_test_buffer (1)));
@@ -1931,12 +1926,23 @@ GST_START_TEST (test_gap_exceeds_latency)
fail_unless_equals_int (GST_FLOW_OK,
gst_harness_push (h, generate_test_buffer (16)));
- /* FIXME: something is up with the timestamp here!!?! */
+ /* Manually check the first rtx event */
out_event = gst_harness_pull_upstream_event (h);
- verify_rtx_event (out_event, 6, 119999994, 10, PCMU_BUF_DURATION);
- /* lost more rtx with weird timestamps... */
+ verify_rtx_event (out_event, 6, 6 * PCMU_BUF_DURATION, 10, PCMU_BUF_DURATION);
+ /* Go throught the rest of rtx events. A bit more relaxed since order is
+ * partly an implentation detail. */
for (i = 0; i < 12; i++) {
- gst_event_unref (gst_harness_pull_upstream_event (h));
+ const GstStructure *s;
+ guint seqnum, retry;
+
+ fail_unless (out_event = gst_harness_pull_upstream_event (h));
+ fail_unless (s = gst_event_get_structure (out_event));
+ fail_unless (gst_structure_get_uint (s, "seqnum", &seqnum));
+ fail_unless (gst_structure_get_uint (s, "retry", &retry));
+ fail_unless (seqnum >= 6 && seqnum <= 12);
+
+ verify_rtx_event (out_event, seqnum, seqnum * PCMU_BUF_DURATION,
+ 10 + retry * 40, PCMU_BUF_DURATION);
}
fail_unless_equals_int (0, gst_harness_upstream_events_in_queue (h));
@@ -1948,19 +1954,20 @@ GST_START_TEST (test_gap_exceeds_latency)
gst_harness_push (h, generate_test_buffer (i)));
}
- /* FIXME: wtf is going on with timestamps and durations here??!? */
gst_harness_crank_single_clock_wait (h);
out_event = gst_harness_pull_event (h);
- verify_lost_event (out_event, 3, 41428571, 78571423);
+ verify_lost_event (out_event, 3, 3 * PCMU_BUF_DURATION,
+ 3 * PCMU_BUF_DURATION);
- /* FIXME: and these rtx... */
gst_harness_crank_single_clock_wait (h);
out_event = gst_harness_pull_event (h);
- verify_lost_event (out_event, 6, 119999994, 21428571);
+ verify_lost_event (out_event, 6, 6 * PCMU_BUF_DURATION,
+ 1 * PCMU_BUF_DURATION);
gst_harness_crank_single_clock_wait (h);
out_event = gst_harness_pull_event (h);
- verify_lost_event (out_event, 7, 141428565, 21428571);
+ verify_lost_event (out_event, 7, 7 * PCMU_BUF_DURATION,
+ 1 * PCMU_BUF_DURATION);
/* 8 */
for (i = 8; i <= 16; i++) {