skip lost sequence number ranges in getIntervalStats (#4166)
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user