From 24a1d7f56cd77ff843055b46cbe9e432e1081403 Mon Sep 17 00:00:00 2001 From: Aaron Boushley Date: Wed, 24 Jan 2018 22:45:21 -0800 Subject: [PATCH] Update audio-stream-controller to respect maxMaxBufferLength. This ensures that when maxMaxBufferLength is set to something smaller than, maxBufferLength the value is respected for both audio and video. --- src/controller/audio-stream-controller.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/controller/audio-stream-controller.js b/src/controller/audio-stream-controller.js index db2c2cb79e2..430460b724d 100644 --- a/src/controller/audio-stream-controller.js +++ b/src/controller/audio-stream-controller.js @@ -184,9 +184,11 @@ class AudioStreamController extends TaskLoop { bufferLen = bufferInfo.len, bufferEnd = bufferInfo.end, fragPrevious = this.fragPrevious, - // ensure we buffer at least config.maxBufferLength (default 30s) + // ensure we buffer at least config.maxBufferLength (default 30s) or config.maxMaxBufferLength (default: 600s) + // whichever is smaller. // once we reach that threshold, don't buffer more than video (mainBufferInfo.len) - maxBufLen = Math.max(config.maxBufferLength,mainBufferInfo.len), + maxConfigBuffer = Math.min(config.maxBufferLength,config.maxMaxBufferLength), + maxBufLen = Math.max(maxConfigBuffer,mainBufferInfo.len), audioSwitch = this.audioSwitch, trackId = this.trackId;