diff --git a/src/controller/base-stream-controller.ts b/src/controller/base-stream-controller.ts index 4d366db2d46..dfbc8e2b2c4 100644 --- a/src/controller/base-stream-controller.ts +++ b/src/controller/base-stream-controller.ts @@ -1029,12 +1029,13 @@ export default class BaseStreamController protected reduceMaxBufferLength(threshold: number, fragDuration: number) { const config = this.config; const minLength = Math.max( - Math.min(threshold, config.maxBufferLength), + Math.min(threshold - fragDuration, config.maxBufferLength), fragDuration, ); const reducedLength = Math.max( threshold - fragDuration * 3, config.maxMaxBufferLength / 2, + minLength, ); if (reducedLength >= minLength) { // reduce max buffer length as it might be too high. we do this to avoid loop flushing ...