diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2015-05-18 17:19:31 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-05-18 18:43:16 +0300 |
commit | 54e924332e2900f55298fe9f925acb9fbafff1ec (patch) | |
tree | 7314f3023d1b31f44fe629cafe75b5add1b62130 /gst/rtpmanager/rtpsource.c | |
parent | 1974b24ef4572ef30eb5556456a7dd29f74f4699 (diff) |
rtpsource: Refactor seqnum comparison code a bit
Diffstat (limited to 'gst/rtpmanager/rtpsource.c')
-rw-r--r-- | gst/rtpmanager/rtpsource.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/gst/rtpmanager/rtpsource.c b/gst/rtpmanager/rtpsource.c index 0ef9e1f06..120162869 100644 --- a/gst/rtpmanager/rtpsource.c +++ b/gst/rtpmanager/rtpsource.c @@ -1013,14 +1013,13 @@ update_receiver_stats (RTPSource * src, RTPPacketInfo * pinfo) src->curr_probation = src->probation; } - delta = gst_rtp_buffer_compare_seqnum (stats->max_seq, seqnr); + expected = src->stats.max_seq + 1; + delta = gst_rtp_buffer_compare_seqnum (expected, seqnr); /* if we are still on probation, check seqnum */ if (src->curr_probation) { - expected = (src->stats.max_seq + 1) & (RTP_SEQ_MOD - 1); - /* when in probation, we require consecutive seqnums */ - if (seqnr == expected) { + if (delta == 0) { /* expected packet */ GST_DEBUG ("probation: seqnr %d == expected %d", seqnr, expected); src->curr_probation--; @@ -1051,7 +1050,7 @@ update_receiver_stats (RTPSource * src, RTPPacketInfo * pinfo) /* unexpected seqnum in probation */ goto probation_seqnum; } - } else if (delta > 0 && delta < RTP_MAX_DROPOUT) { + } else if (delta >= 0 && delta < RTP_MAX_DROPOUT) { /* in order, with permissible gap */ if (seqnr < stats->max_seq) { /* sequence number wrapped - count another 64K cycle. */ @@ -1070,10 +1069,10 @@ update_receiver_stats (RTPSource * src, RTPPacketInfo * pinfo) stats->bad_seq = (seqnr + 1) & (RTP_SEQ_MOD - 1); goto bad_sequence; } - } else { /* delta <= 0 && delta >= -RTP_MAX_MISORDER */ + } else { /* delta < 0 && delta >= -RTP_MAX_MISORDER */ /* duplicate or reordered packet, will be filtered by jitterbuffer. */ - GST_WARNING ("duplicate or reordered packet (seqnr %d, max seq %d)", seqnr, - stats->max_seq); + GST_WARNING ("duplicate or reordered packet (seqnr %u, expected %u)", seqnr, + expected); } src->stats.octets_received += pinfo->payload_len; @@ -1082,7 +1081,7 @@ update_receiver_stats (RTPSource * src, RTPPacketInfo * pinfo) /* for the bitrate estimation */ src->bytes_received += pinfo->payload_len; - GST_LOG ("seq %d, PC: %" G_GUINT64_FORMAT ", OC: %" G_GUINT64_FORMAT, + GST_LOG ("seq %u, PC: %" G_GUINT64_FORMAT ", OC: %" G_GUINT64_FORMAT, seqnr, src->stats.packets_received, src->stats.octets_received); return TRUE; |