From 3bed51ca1ef3698c86febfd8ecb9ac613e77a1b1 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Fri, 10 Sep 2010 10:37:58 -0400 Subject: [PATCH] - minor cleanup --- .../red5/media/RtpStreamReceiver.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/RtpStreamReceiver.java b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/RtpStreamReceiver.java index d153897d20..99e0388bf6 100755 --- a/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/RtpStreamReceiver.java +++ b/bbb-voice/src/main/java/org/bigbluebutton/voiceconf/red5/media/RtpStreamReceiver.java @@ -116,7 +116,7 @@ public class RtpStreamReceiver { * another "start" timestamp will be generated for the voice. (ralam, sept 7, 2010). * && packetIsNotCorrupt(rtpPacket)) { **/ - return validSeqNum(rtpPacket) || seqNumRollOver(rtpPacket); + return validSeqNum(rtpPacket) || seqNumRolledOver(rtpPacket); } @@ -127,14 +127,17 @@ public class RtpStreamReceiver { return (rtpPacket.getSeqNum() > lastSequenceNumber && rtpPacket.getSeqNum() - lastSequenceNumber < 100); } - private boolean seqNumRollOver(RtpPacket rtpPacket) { - boolean rolledOver = lastSequenceNumber - rtpPacket.getSeqNum() > 65000; - - if (rolledOver) { - log.debug("Packet rolling over seqNum[rtpSeqNum=" + rtpPacket.getSeqNum() + ",lastSeqNum=" + lastSequenceNumber - + "][rtpTS=" + rtpPacket.getTimestamp() + ",lastTS=" + lastPacketTimestamp + "][port=" + rtpSocket.getDatagramSocket().getLocalPort() + "]"); + private boolean seqNumRolledOver(RtpPacket rtpPacket) { + /* + * Max sequence num is 65535 (16-bits). Let's use 65000 as check to take into account + * delayed packets. + */ + if (lastSequenceNumber - rtpPacket.getSeqNum() > 65000) { + log.debug("Packet rolling over seqNum[rtpSeqNum=" + rtpPacket.getSeqNum() + ",lastSeqNum=" + lastSequenceNumber + + "][rtpTS=" + rtpPacket.getTimestamp() + ",lastTS=" + lastPacketTimestamp + "][port=" + rtpSocket.getDatagramSocket().getLocalPort() + "]"); + return true; } - return rolledOver; + return false; } private void processRtpPacket(RtpPacket rtpPacket) {