mirror of
https://github.com/livekit/livekit.git
synced 2026-03-30 19:55:41 +00:00
Do not log warns on duplicate. (#2807)
With RTX, some clients use very old packets for probing. Check for duplicate before logging warning about old packet/negative sequence number jump. Also, double the history so that duplicate tracking is better. Adds about 1/2 KB per RTP stream.
This commit is contained in:
@@ -611,12 +611,23 @@ func (b *Buffer) calc(rawPkt []byte, rtpPacket *rtp.Packet, arrivalTime time.Tim
|
||||
rtpPacket.Header.SequenceNumber = uint16(flowState.ExtSequenceNumber)
|
||||
_, err = b.bucket.AddPacketWithSequenceNumber(rawPkt, rtpPacket.Header.SequenceNumber)
|
||||
if err != nil {
|
||||
if errors.Is(err, bucket.ErrPacketTooOld) {
|
||||
packetTooOldCount := b.packetTooOldCount.Inc()
|
||||
if (packetTooOldCount-1)%100 == 0 {
|
||||
if !flowState.IsDuplicate {
|
||||
if errors.Is(err, bucket.ErrPacketTooOld) {
|
||||
packetTooOldCount := b.packetTooOldCount.Inc()
|
||||
if (packetTooOldCount-1)%100 == 0 {
|
||||
b.logger.Warnw(
|
||||
"could not add packet to bucket", err,
|
||||
"count", packetTooOldCount,
|
||||
"flowState", &flowState,
|
||||
"snAdjustment", snAdjustment,
|
||||
"incomingSequenceNumber", flowState.ExtSequenceNumber+snAdjustment,
|
||||
"rtpStats", b.rtpStats,
|
||||
"snRangeMap", b.snRangeMap,
|
||||
)
|
||||
}
|
||||
} else if err != bucket.ErrRTXPacket {
|
||||
b.logger.Warnw(
|
||||
"could not add packet to bucket", err,
|
||||
"count", packetTooOldCount,
|
||||
"flowState", &flowState,
|
||||
"snAdjustment", snAdjustment,
|
||||
"incomingSequenceNumber", flowState.ExtSequenceNumber+snAdjustment,
|
||||
@@ -624,15 +635,6 @@ func (b *Buffer) calc(rawPkt []byte, rtpPacket *rtp.Packet, arrivalTime time.Tim
|
||||
"snRangeMap", b.snRangeMap,
|
||||
)
|
||||
}
|
||||
} else if err != bucket.ErrRTXPacket {
|
||||
b.logger.Warnw(
|
||||
"could not add packet to bucket", err,
|
||||
"flowState", &flowState,
|
||||
"snAdjustment", snAdjustment,
|
||||
"incomingSequenceNumber", flowState.ExtSequenceNumber+snAdjustment,
|
||||
"rtpStats", b.rtpStats,
|
||||
"snRangeMap", b.snRangeMap,
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
cHistorySize = 4096
|
||||
cHistorySize = 8192
|
||||
|
||||
// RTCP Sender Reports are re-based to SFU time base so that all subscriber side
|
||||
// can have the same time base (i. e. SFU time base). To convert publisher side
|
||||
@@ -219,16 +219,6 @@ func (r *RTPStatsReceiver) Update(
|
||||
}
|
||||
}
|
||||
if gapSN <= 0 { // duplicate OR out-of-order
|
||||
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 gapSN != 0 {
|
||||
r.packetsOutOfOrder++
|
||||
}
|
||||
@@ -248,6 +238,16 @@ func (r *RTPStatsReceiver) Update(
|
||||
flowState.IsOutOfOrder = true
|
||||
flowState.ExtSequenceNumber = resSN.ExtendedVal
|
||||
flowState.ExtTimestamp = resTS.ExtendedVal
|
||||
|
||||
if !flowState.IsDuplicate && -gapSN >= cSequenceNumberLargeJumpThreshold {
|
||||
if r.largeJumpNegativeCount%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 {
|
||||
|
||||
Reference in New Issue
Block a user