skip lost sequence number ranges in getIntervalStats (#4166)

This commit is contained in:
Paul Wells
2025-12-17 00:02:51 -08:00
committed by GitHub
parent 898ebe058c
commit 2f2d0a5735
+11 -10
View File
@@ -1268,13 +1268,18 @@ func (r *RTPStatsSender) getIntervalStats(
extEndExclusive uint64, extEndExclusive uint64,
ehsn uint64, ehsn uint64,
) (intervalStats intervalStats) { ) (intervalStats intervalStats) {
processESN := func(esn uint64, ehsn uint64) { upperBound := ehsn + 1
slot := r.getSnInfoOutOfOrderSlot(esn, ehsn) lowerBound := uint64(0)
if slot < 0 { if n := uint64(len(r.snInfos)); n != 0 && ehsn >= n-1 {
intervalStats.packetsNotFoundMetadata++ lowerBound = ehsn - n + 1
return }
} extStartInclusiveClamped := max(min(extStartInclusive, upperBound), lowerBound)
extEndExclusiveClamped := max(min(extEndExclusive, upperBound), extStartInclusive)
intervalStats.packetsNotFoundMetadata += (extEndExclusive - extStartInclusive) - (extEndExclusiveClamped - extStartInclusiveClamped)
for esn := extStartInclusiveClamped; esn != extEndExclusiveClamped; esn++ {
slot := r.getSnInfoOutOfOrderSlot(esn, ehsn)
snInfo := &r.snInfos[slot] snInfo := &r.snInfos[slot]
switch { switch {
case snInfo.pktSize == 0: case snInfo.pktSize == 0:
@@ -1298,10 +1303,6 @@ func (r *RTPStatsSender) getIntervalStats(
intervalStats.frames++ intervalStats.frames++
} }
} }
for esn := extStartInclusive; esn != extEndExclusive; esn++ {
processESN(esn, ehsn)
}
return return
} }