Commit 20561fd7 authored by Håvard Graff's avatar Håvard Graff

rtpjitterbuffer: don't calculate packet-rate for jumping seqnums

As demonstrated by the test, you can end up in situations where
your packet-rate gets insanly high, and you produce thousands of RTX-timers
/lost events, when the big-gap logic is there to prevent exactly that.
parent 8e3184a2
Pipeline #133311 failed with stages
in 68 minutes and 22 seconds
......@@ -55,10 +55,10 @@ gst_rtp_packet_rate_ctx_update (RTPPacketRateCtx * ctx, guint16 seqnum,
}
diff_seqnum = gst_rtp_buffer_compare_seqnum (ctx->last_seqnum, seqnum);
/* Ignore seqnums that are over 15,000 away from the latest one, it's close
* to 2^14 but far enough to avoid any risk of computing error.
/* Ignore seqnums that are not strictly sequential from the last one.
That way we don't taint our estimate with "bad" packets
*/
if (diff_seqnum > 15000)
if (diff_seqnum > 1)
goto done_but_save;
/* Ignore any packet that is in the past, we're only interested in newer
......
......@@ -2451,26 +2451,43 @@ GST_START_TEST (test_deadline_ts_offset)
GST_END_TEST;
typedef struct
{
GstClockTime delta_dts;
guint delta_seqnum;
guint delta_rtptime;
} BigGapCtx;
/* TEST_RTP_TS_DURATION = 160 */
static BigGapCtx big_gap_testdata[] = {
{0, 20000, 20000 * 160},
{0, 10000, 10000 * 160},
{0, 10000, 0 * 160},
{0, 3000, 3000 * 160},
};
GST_START_TEST (test_big_gap_seqnum)
{
GstHarness *h = gst_harness_new ("rtpjitterbuffer");
const gint num_consecutive = 5;
const guint gap = 20000;
gint i;
guint seqnum_org;
GstClockTime dts_base;
guint seqnum_base;
guint32 rtpts_base;
GstClockTime expected_ts;
BigGapCtx *ctx = &big_gap_testdata[__i__];
g_object_set (h->element, "do-lost", TRUE, "do-retransmission", TRUE, NULL);
seqnum_org = construct_deterministic_initial_state (h, 100);
/* a sudden jump in sequence-numbers (and rtptime), but packets keep arriving
at the same pace */
dts_base = seqnum_org * TEST_BUF_DURATION;
seqnum_base = seqnum_org + gap;
rtpts_base = seqnum_base * TEST_RTP_TS_DURATION;
seqnum_base = seqnum_org;
rtpts_base = seqnum_org * TEST_RTP_TS_DURATION;
dts_base += ctx->delta_dts;
seqnum_base += ctx->delta_seqnum;
rtpts_base += ctx->delta_rtptime;
for (i = 0; i < num_consecutive; i++) {
fail_unless_equals_int (GST_FLOW_OK, gst_harness_push (h,
......@@ -3180,7 +3197,8 @@ rtpjitterbuffer_suite (void)
tcase_add_test (tc_chain, test_dont_drop_packet_based_on_skew);
tcase_add_test (tc_chain, test_deadline_ts_offset);
tcase_add_test (tc_chain, test_big_gap_seqnum);
tcase_add_loop_test (tc_chain, test_big_gap_seqnum, 0,
G_N_ELEMENTS (big_gap_testdata));
tcase_add_test (tc_chain, test_big_gap_arrival_time);
tcase_add_test (tc_chain, test_fill_queue);
......
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