/** * Updates the participant with information for receiver reports. * * @param packetLength to keep track of received octets * @param pkt the most recently received packet */ protected void updateRRStats(int packetLength, RtpPkt pkt) { int curSeqNum = pkt.getSeqNumber(); if (firstSeqNumber < 0) { firstSeqNumber = curSeqNum; } receivedOctets += packetLength; receivedSinceLastSR++; receivedPkts++; long curTime = System.currentTimeMillis(); if (this.lastSeqNumber < curSeqNum) { // In-line packet, best thing you could hope for this.lastSeqNumber = curSeqNum; } else if (this.lastSeqNumber - this.lastSeqNumber < -100) { // Sequence counter rolled over this.lastSeqNumber = curSeqNum; seqRollOverCount++; } else { // This was probably a duplicate or a late arrival. } // Calculate jitter if (this.lastRtpPkt > 0) { long D = (pkt.getTimeStamp() - curTime) - (this.lastRtpTimestamp - this.lastRtpPkt); if (D < 0) D = (-1) * D; this.interArrivalJitter += ((double) D - this.interArrivalJitter) / 16.0; } lastRtpPkt = curTime; lastRtpTimestamp = pkt.getTimeStamp(); }