Skip to content

Commit

Permalink
Make sure reduceMaxBufferLength can reach a min length of fragment …
Browse files Browse the repository at this point in the history
…duration resulting in buffer full error (#6539)

Resolves #6535
  • Loading branch information
robwalch authored Jul 3, 2024
1 parent b62c72d commit cedf96d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/controller/base-stream-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...
Expand Down

0 comments on commit cedf96d

Please sign in to comment.