mirror of
https://github.com/livekit/livekit.git
synced 2026-10-23 10:52:46 +00:00
skip lost sequence number ranges in getIntervalStats (#4166)
This commit is contained in:
1 parent
898ebe058c
commit
2f2d0a5735
1 file changed
+11
-10
@@ -1268,13 +1268,18 @@ func (r *RTPStatsSender) getIntervalStats(
|
||||
extEndExclusive uint64,
|
||||
ehsn uint64,
|
||||
) (intervalStats intervalStats) {
|
||||
processESN := func(esn uint64, ehsn uint64) {
|
||||
slot := r.getSnInfoOutOfOrderSlot(esn, ehsn)
|
||||
if slot < 0 {
|
||||
intervalStats.packetsNotFoundMetadata++
|
||||
return
|
||||
}
|
||||
upperBound := ehsn + 1
|
||||
lowerBound := uint64(0)
|
||||
if n := uint64(len(r.snInfos)); n != 0 && ehsn >= n-1 {
|
||||
lowerBound = ehsn - n + 1
|
||||
}
|
||||
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]
|
||||
switch {
|
||||
case snInfo.pktSize == 0:
|
||||
@@ -1298,10 +1303,6 @@ func (r *RTPStatsSender) getIntervalStats(
|
||||
intervalStats.frames++
|
||||
}
|
||||
}
|
||||
|
||||
for esn := extStartInclusive; esn != extEndExclusive; esn++ {
|
||||
processESN(esn, ehsn)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user