Protect against incorrect temporal layer. (#4327)
Seeing some tracks with temporal layer higher than array bounds. Protect against it and log some info to understand better.
This commit is contained in:
@@ -69,8 +69,8 @@ type StreamTracker struct {
|
|||||||
lastNotifiedStatus StreamStatus
|
lastNotifiedStatus StreamStatus
|
||||||
|
|
||||||
lastBitrateReport time.Time
|
lastBitrateReport time.Time
|
||||||
bytesForBitrate [4]int64
|
bytesForBitrate [buffer.DefaultMaxLayerTemporal + 1]int64
|
||||||
bitrate [4]int64
|
bitrate [buffer.DefaultMaxLayerTemporal + 1]int64
|
||||||
|
|
||||||
isStopped bool
|
isStopped bool
|
||||||
}
|
}
|
||||||
@@ -207,8 +207,17 @@ func (s *StreamTracker) Observe(
|
|||||||
go s.worker(s.generation.Load())
|
go s.worker(s.generation.Load())
|
||||||
}
|
}
|
||||||
|
|
||||||
if temporalLayer >= 0 {
|
if temporalLayer >= 0 && int(temporalLayer) < len(s.bytesForBitrate) {
|
||||||
s.bytesForBitrate[temporalLayer] += int64(pktSize)
|
s.bytesForBitrate[temporalLayer] += int64(pktSize)
|
||||||
|
} else if int(temporalLayer) >= len(s.bytesForBitrate) {
|
||||||
|
s.params.Logger.Warnw(
|
||||||
|
"invalid temporal layer", nil,
|
||||||
|
"temporalLayer", temporalLayer,
|
||||||
|
"pktSize", pktSize,
|
||||||
|
"payloadSize", payloadSize,
|
||||||
|
"hasMarker", hasMarker,
|
||||||
|
"ts", ts,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
s.lock.Unlock()
|
s.lock.Unlock()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user