Skip to content

Commit

Permalink
add buffer full handling
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkim9 committed Jan 10, 2018
1 parent 53876ed commit 5847693
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/controller/stream-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ class StreamController extends TaskLoop {
}

// Allow backtracked fragments to load
if(frag.backtracked || fragState === FragmentState.NOT_LOADED) {
if (frag.backtracked || fragState === FragmentState.NOT_LOADED) {
frag.autoLevel = this.hls.autoLevelEnabled;
frag.bitrateTest = this.bitrateTest;

Expand All @@ -500,6 +500,11 @@ class StreamController extends TaskLoop {
this.demuxer = new Demuxer(this.hls,'main');
}
this.state = State.FRAG_LOADING;
} else if (fragState === FragmentState.APPENDING) {
// Lower the buffer size and try again
if (this._reduceMaxBufferLength(frag.duration)) {
this.fragmentTracker.removeFragment(frag);
}
}
}
}
Expand Down Expand Up @@ -1345,7 +1350,9 @@ class StreamController extends TaskLoop {
// reduce max buffer length as it might be too high. we do this to avoid loop flushing ...
config.maxMaxBufferLength/=2;
logger.warn(`main:reduce max buffer length to ${config.maxMaxBufferLength}s`);
return true;
}
return false;
}

_checkBuffer() {
Expand Down

0 comments on commit 5847693

Please sign in to comment.