From bf31b488546cf069b5c9ec0953a226159ba7d84e Mon Sep 17 00:00:00 2001 From: FuriousBoar Date: Tue, 9 Aug 2022 09:28:15 +0200 Subject: [PATCH] Fix stalling when using buffer.fastSwitchEnabled setting (#4004) According to the docs in Settings, the value used by StreamProcessor was wrong. The problem occurred on an environment with high latency and low bandwidth, where segments' length was 3s, which is significantly longer than previously hardcoded 1.5s. --- src/streaming/StreamProcessor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/streaming/StreamProcessor.js b/src/streaming/StreamProcessor.js index b2abe01e90..1771a62e88 100644 --- a/src/streaming/StreamProcessor.js +++ b/src/streaming/StreamProcessor.js @@ -660,7 +660,7 @@ function StreamProcessor(config) { function _prepareForFastQualitySwitch(representationInfo) { // if we switch up in quality and need to replace existing parts in the buffer we need to adjust the buffer target const time = playbackController.getTime(); - let safeBufferLevel = 1.5; + let safeBufferLevel = 1.5 * (!isNaN(representationInfo.fragmentDuration) ? representationInfo.fragmentDuration : 1); const request = fragmentModel.getRequests({ state: FragmentModel.FRAGMENT_MODEL_EXECUTED, time: time + safeBufferLevel,