mirror of
https://github.com/livekit/livekit.git
synced 2026-03-29 07:09:51 +00:00
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:
committed by
Paul Wells
parent
ee664e7adc
commit
a82d88a7a7
@@ -69,8 +69,8 @@ type StreamTracker struct {
|
||||
lastNotifiedStatus StreamStatus
|
||||
|
||||
lastBitrateReport time.Time
|
||||
bytesForBitrate [4]int64
|
||||
bitrate [4]int64
|
||||
bytesForBitrate [buffer.DefaultMaxLayerTemporal + 1]int64
|
||||
bitrate [buffer.DefaultMaxLayerTemporal + 1]int64
|
||||
|
||||
isStopped bool
|
||||
}
|
||||
@@ -207,8 +207,17 @@ func (s *StreamTracker) Observe(
|
||||
go s.worker(s.generation.Load())
|
||||
}
|
||||
|
||||
if temporalLayer >= 0 {
|
||||
if temporalLayer >= 0 && int(temporalLayer) < len(s.bytesForBitrate) {
|
||||
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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user