Skip to content

Commit 3f7c9d3

Browse files
committed
Fix subtitle buffering up to or past media buffer
Fixes regression introduced in dev with #7522 that only loaded current and next subtitle segment
1 parent 4f8ada6 commit 3f7c9d3

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/controller/subtitle-stream-controller.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,13 +444,15 @@ export class SubtitleStreamController
444444
config.maxBufferHole,
445445
);
446446
const { end: targetBufferTime, len: bufferLen } = bufferedInfo;
447-
const maxBufLen =
448-
this.hls.maxBufferLength + trackDetails.levelTargetDuration;
447+
const maxBufLen = Math.max(
448+
this.hls.maxBufferLength + trackDetails.levelTargetDuration,
449+
this.hls.mainForwardBufferInfo?.len || 0,
450+
);
449451

450452
if (bufferLen > maxBufLen || (bufferLen && !this.buffering)) {
451453
return;
452454
}
453-
let frag = this.getNextFragment(currentTime, trackDetails);
455+
let frag = this.getNextFragment(targetBufferTime, trackDetails);
454456
if (!frag) {
455457
return;
456458
}

0 commit comments

Comments
 (0)