Skip to content

Commit

Permalink
stream-controller: don't start loading first fragment if first LEVEL_…
Browse files Browse the repository at this point in the history
…LOADED not received yet

fix EXT-X-START not honored on single level playlist
related to #1353

regression introduced by 8db8ea3
  • Loading branch information
mangui committed Sep 20, 2017
1 parent 94c5b62 commit 617344c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/controller/stream-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ class StreamController extends EventHandler {
config = hls.config,
media = this.media;

// if video not attached AND
// start fragment already requested OR start frag prefetch disable
// exit loop
// => if start level loaded and media not attached but start frag prefetch is enabled and start frag not requested yet, we will not exit loop
if (this.levelLastLoaded !== undefined && !media &&
(this.startFragRequested || !config.startFragPrefetch)) {

// if start level not parsed yet OR
// if video not attached AND start fragment already requested OR start frag prefetch disable
// exit loop, as we either need more info (level not parsed) or we need media to be attached to load new fragment
if (this.levelLastLoaded === undefined || (
!media && (this.startFragRequested || !config.startFragPrefetch))) {
return;
}

Expand Down Expand Up @@ -411,7 +411,7 @@ class StreamController extends EventHandler {
// return -1 return 0 return 1
//logger.log(`level/sn/start/end/bufEnd:${level}/${candidate.sn}/${candidate.start}/${(candidate.start+candidate.duration)}/${bufferEnd}`);
// Set the lookup tolerance to be small enough to detect the current segment - ensures we don't skip over very small segments
let candidateLookupTolerance = Math.min(maxFragLookUpTolerance, candidate.duration);
let candidateLookupTolerance = Math.min(maxFragLookUpTolerance, candidate.duration + (candidate.deltaPTS ? candidate.deltaPTS : 0));
if (candidate.start + candidate.duration - candidateLookupTolerance <= bufferEnd) {
return 1;
} // if maxFragLookUpTolerance will have negative value then don't return -1 for first element
Expand Down Expand Up @@ -892,7 +892,6 @@ class StreamController extends EventHandler {
logger.log('both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC');
}
this.levels = data.levels;
this.startLevelLoaded = false;
this.startFragRequested = false;
let config = this.config;
if (config.autoStartLoad || this.forceStartLoad) {
Expand Down

0 comments on commit 617344c

Please sign in to comment.