From 6bb48dd6f141ccfb97b790d38647f00b8c456036 Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Mon, 24 Jun 2024 12:51:35 +0530 Subject: [PATCH] Do not log duplicate on large negative on send side (#2815) --- pkg/sfu/buffer/rtpstats_receiver.go | 8 ++++---- pkg/sfu/buffer/rtpstats_sender.go | 23 ++++++++++++----------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/pkg/sfu/buffer/rtpstats_receiver.go b/pkg/sfu/buffer/rtpstats_receiver.go index f637f126..b67a50a0 100644 --- a/pkg/sfu/buffer/rtpstats_receiver.go +++ b/pkg/sfu/buffer/rtpstats_receiver.go @@ -240,23 +240,23 @@ func (r *RTPStatsReceiver) Update( flowState.ExtTimestamp = resTS.ExtendedVal if !flowState.IsDuplicate && -gapSN >= cSequenceNumberLargeJumpThreshold { - if r.largeJumpNegativeCount%100 == 0 { + r.largeJumpNegativeCount++ + if (r.largeJumpNegativeCount-1)%100 == 0 { r.logger.Warnw( "large sequence number gap negative", nil, append(getLoggingFields(), "count", r.largeJumpNegativeCount)..., ) } - r.largeJumpNegativeCount++ } } else { // in-order if gapSN >= cSequenceNumberLargeJumpThreshold || resTS.ExtendedVal < resTS.PreExtendedHighest { - if r.largeJumpCount%100 == 0 { + r.largeJumpCount++ + if (r.largeJumpCount-1)%100 == 0 { r.logger.Warnw( "large sequence number gap OR time reversed", nil, append(getLoggingFields(), "count", r.largeJumpCount)..., ) } - r.largeJumpCount++ } // update gap histogram diff --git a/pkg/sfu/buffer/rtpstats_sender.go b/pkg/sfu/buffer/rtpstats_sender.go index 215520f4..9740a7fb 100644 --- a/pkg/sfu/buffer/rtpstats_sender.go +++ b/pkg/sfu/buffer/rtpstats_sender.go @@ -316,15 +316,6 @@ func (r *RTPStatsSender) Update( // do not start on a padding only packet return } - if -gapSN >= cSequenceNumberLargeJumpThreshold { - if r.largeJumpNegativeCount%100 == 0 { - r.logger.Warnw( - "large sequence number gap negative", nil, - append(getLoggingFields(), "count", r.largeJumpNegativeCount)..., - ) - } - r.largeJumpNegativeCount++ - } if extSequenceNumber < r.extStartSN { r.packetsLost += r.extStartSN - extSequenceNumber @@ -371,15 +362,25 @@ func (r *RTPStatsSender) Update( r.packetsLost-- r.setSnInfo(extSequenceNumber, r.extHighestSN, uint16(pktSize), uint8(hdrSize), uint16(payloadSize), marker, true) } + + if !isDuplicate && -gapSN >= cSequenceNumberLargeJumpThreshold { + r.largeJumpNegativeCount++ + if (r.largeJumpNegativeCount-1)%100 == 0 { + r.logger.Warnw( + "large sequence number gap negative", nil, + append(getLoggingFields(), "count", r.largeJumpNegativeCount)..., + ) + } + } } else { // in-order if gapSN >= cSequenceNumberLargeJumpThreshold || extTimestamp < r.extHighestTS { - if r.largeJumpCount%100 == 0 { + r.largeJumpCount++ + if (r.largeJumpCount-1)%100 == 0 { r.logger.Warnw( "large sequence number gap OR time reversed", nil, append(getLoggingFields(), "count", r.largeJumpCount)..., ) } - r.largeJumpCount++ } // update gap histogram