set limit for maxVideoFrameCacheDuration to 2s.

This commit is contained in:
cloudwebrtc
2026-06-29 10:58:06 +08:00
parent 84443e66e2
commit 089fb906cd
+14
View File
@@ -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
}