Skip to content

Commit

Permalink
Never back-track on first fragment to avoid loop loading
Browse files Browse the repository at this point in the history
Fixes #5609

(cherry picked from commit 5f06ba8)
  • Loading branch information
robwalch committed Jul 3, 2023
1 parent 7002632 commit 8c099ae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/controller/stream-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,7 @@ export default class StreamController
}

// Avoid buffering if backtracking this fragment
const notFirstFragment = frag.sn !== details?.startSN;
if (video && remuxResult.independent !== false) {
if (details) {
const { startPTS, endPTS, startDTS, endDTS } = video;
Expand All @@ -1129,7 +1130,10 @@ export default class StreamController
const startTime = video.firstKeyFramePTS
? video.firstKeyFramePTS
: startPTS;
if (targetBufferTime < startTime - this.config.maxBufferHole) {
if (
notFirstFragment &&
targetBufferTime < startTime - this.config.maxBufferHole
) {
this.backtrack(frag);
return;
}
Expand All @@ -1156,7 +1160,7 @@ export default class StreamController
}
this.bufferFragmentData(video, frag, part, chunkMeta);
}
} else if (remuxResult.independent === false) {
} else if (notFirstFragment && remuxResult.independent === false) {
this.backtrack(frag);
return;
}
Expand Down

0 comments on commit 8c099ae

Please sign in to comment.