Skip to content

Commit

Permalink
Merge pull request #5613 from video-dev/bugfix/holes-on-first-no-back…
Browse files Browse the repository at this point in the history
…track

Never back-track on first fragment to avoid loop loading
  • Loading branch information
robwalch authored Jul 3, 2023
2 parents 34a35f8 + 5f06ba8 commit 713995b
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 @@ -1111,6 +1111,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 @@ -1135,7 +1136,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 @@ -1162,7 +1166,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 713995b

Please sign in to comment.