mirror of
https://github.com/livekit/livekit.git
synced 2026-08-28 11:44:43 +00:00
set limit for maxVideoFrameCacheDuration to 2s.
This commit is contained in:
@@ -93,8 +93,22 @@ func WithForwardStats(forwardStats *ForwardStats) ReceiverOpts {
|
||||
}
|
||||
}
|
||||
|
||||
// maxVideoFrameCacheDuration caps the video frame cache window: a longer cached interval would size
|
||||
// the retransmit bucket too aggressively and delay subscriber bootstrap, so requests above it are
|
||||
// clamped down.
|
||||
const maxVideoFrameCacheDuration = 2 * time.Second
|
||||
|
||||
func WithVideoFrameCache(maxDuration time.Duration) ReceiverOpts {
|
||||
return func(w *WebRTCReceiver) *WebRTCReceiver {
|
||||
if maxDuration > maxVideoFrameCacheDuration {
|
||||
w.ReceiverBase.Logger().Infow(
|
||||
"clamping video frame cache duration",
|
||||
"requested", maxDuration,
|
||||
"max", maxVideoFrameCacheDuration,
|
||||
)
|
||||
maxDuration = maxVideoFrameCacheDuration
|
||||
}
|
||||
|
||||
w.ReceiverBase.EnableVideoFrameCache(maxDuration)
|
||||
return w
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user