Skip to content

Commit

Permalink
stream-controller: account for level sliding when computing buffer En…
Browse files Browse the repository at this point in the history
…d PDT

related to video-dev#1624 video-dev#1626
  • Loading branch information
mangui committed Mar 27, 2018
1 parent 9b429dc commit 6a9f928
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/controller/stream-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,8 @@ class StreamController extends TaskLoop {
if (!levelDetails.programDateTime) { // Uses buffer and sequence number to calculate switch segment (required if using EXT-X-DISCONTINUITY-SEQUENCE)
foundFrag = this._findFragmentBySN(fragPrevious, fragments, bufferEnd, end);
} else { // Relies on PDT in order to switch bitrates (Support EXT-X-DISCONTINUITY without EXT-X-DISCONTINUITY-SEQUENCE)
foundFrag = this._findFragmentByPDT(fragments, (bufferEnd * 1000) + (levelDetails.programDateTime ? Date.parse(levelDetails.programDateTime) : 0));
// compute PDT of bufferEnd: PDT(bufferEnd) = 1000*bufferEnd + PDT(start) = 1000*bufferEnd + PDT(level) - level sliding
foundFrag = this._findFragmentByPDT(fragments, (bufferEnd * 1000) + (levelDetails.programDateTime ? Date.parse(levelDetails.programDateTime) : 0) - 1000 * start);
}
} else {
// reach end of playlist
Expand Down

0 comments on commit 6a9f928

Please sign in to comment.