Skip to content

Commit

Permalink
improve track switch process, do not reload abandonned request.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosang committed Mar 12, 2018
1 parent c77521c commit 94583c7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/streaming/Stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ function Stream(config) {
if (mediaInfo.type !== Constants.FRAGMENTED_TEXT) {
abrController.updateTopQualityIndex(mediaInfo);
processor.switchTrackAsked();
processor.getFragmentModel().abortRequests();
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/streaming/controllers/BufferController.js
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,9 @@ function BufferController(config) {
updateBufferLevel();
} else {
bufferResetInProgress = false;
appendToBuffer(mediaChunk);
if (mediaChunk) {
appendToBuffer(mediaChunk);
}
}
eventBus.trigger(Events.BUFFER_CLEARED, { sender: instance, from: e.from, to: e.to, hasEnoughSpaceToAppend: hasEnoughSpaceToAppend() });
}
Expand Down Expand Up @@ -718,7 +720,6 @@ function BufferController(config) {
if (ranges && ranges.length > 0 && playbackController.getTimeToStreamEnd() > STALL_THRESHOLD) {
isBufferingCompleted = false;
lastIndex = Number.POSITIVE_INFINITY;
streamProcessor.getFragmentModel().abortRequests();
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/streaming/controllers/ScheduleController.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,8 @@ function ScheduleController(config) {
return;
}
log('[ScheduleController][onFragmentLoadingAbandoned] for ' + type + ', request: ' + e.request.url + ' has been aborted');
if (!playbackController.isSeeking()) {
log('[ScheduleController][onFragmentLoadingAbandoned] for ' + type + ', request: ' + e.request.url + ' has to be downloaded again, origin is not seeking process');
if (!playbackController.isSeeking() && !switchTrack) {
log('[ScheduleController][onFragmentLoadingAbandoned] for ' + type + ', request: ' + e.request.url + ' has to be downloaded again, origin is not seeking process or switch track call');
replaceRequest(e.request);
}
setFragmentProcessState(false);
Expand Down

0 comments on commit 94583c7

Please sign in to comment.