From 1974b24ef4572ef30eb5556456a7dd29f74f4699 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 18 May 2015 17:08:53 +0300 Subject: [PATCH] rtpsource: Allow sequence number wraparound during probation --- gst/rtpmanager/rtpsource.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gst/rtpmanager/rtpsource.c b/gst/rtpmanager/rtpsource.c index 2e984e3..0ef9e1f 100644 --- a/gst/rtpmanager/rtpsource.c +++ b/gst/rtpmanager/rtpsource.c @@ -1017,14 +1017,19 @@ update_receiver_stats (RTPSource * src, RTPPacketInfo * pinfo) /* if we are still on probation, check seqnum */ if (src->curr_probation) { - expected = src->stats.max_seq + 1; + expected = (src->stats.max_seq + 1) & (RTP_SEQ_MOD - 1); /* when in probation, we require consecutive seqnums */ if (seqnr == expected) { /* expected packet */ GST_DEBUG ("probation: seqnr %d == expected %d", seqnr, expected); src->curr_probation--; + if (seqnr < stats->max_seq) { + /* sequence number wrapped - count another 64K cycle. */ + stats->cycles += RTP_SEQ_MOD; + } src->stats.max_seq = seqnr; + if (src->curr_probation == 0) { GST_DEBUG ("probation done!"); init_seq (src, seqnr); -- 2.7.4