Skip to content

Commit

Permalink
Do not handle abandoned fragments in case the abort was triggered by …
Browse files Browse the repository at this point in the history
…a representation switch
  • Loading branch information
dsilhavy committed May 21, 2021
1 parent 91fd6c1 commit 205854c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/streaming/StreamProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ function StreamProcessor(config) {
scheduleController,
representationController,
shouldUseExplicitTimeForRequest,
qualityChangeInProgress,
manifestUpdateInProgress,
dashHandler,
segmentsController,
Expand Down Expand Up @@ -202,6 +203,7 @@ function StreamProcessor(config) {
bufferingTime = 0;
shouldUseExplicitTimeForRequest = false;
manifestUpdateInProgress = false;
qualityChangeInProgress = false;
}

function reset(errored, keepBuffers) {
Expand Down Expand Up @@ -521,6 +523,8 @@ function StreamProcessor(config) {
logger.debug(`Preparing quality switch for type ${type}`);
const newQuality = e.newQuality;

qualityChangeInProgress = true;

// Stop scheduling until we are done with preparing the quality switch
scheduleController.clearScheduleTimer();

Expand Down Expand Up @@ -569,9 +573,11 @@ function StreamProcessor(config) {
bufferController.prepareForReplacementQualitySwitch()
.then(() => {
_bufferClearedForReplacement();
qualityChangeInProgress = false;
})
.catch(() => {
_bufferClearedForReplacement();
qualityChangeInProgress = false;
});
}

Expand Down Expand Up @@ -600,11 +606,13 @@ function StreamProcessor(config) {
} else {
scheduleController.startScheduleTimer();
}
qualityChangeInProgress = false;
}

function _prepareForDefaultQualitySwitch() {
// We might have aborted the current request. We need to set an explicit buffer time based on what we already have in the buffer.
_bufferClearedForNonReplacement()
qualityChangeInProgress = false;
}

/**
Expand All @@ -614,8 +622,8 @@ function StreamProcessor(config) {
function _onFragmentLoadingAbandoned(e) {
logger.info('onFragmentLoadingAbandoned request: ' + e.request.url + ' has been aborted');

// we only need to handle this if we are not seeking or switching the tracks
if (!playbackController.isSeeking() && !scheduleController.getSwitchStrack()) {
// we only need to handle this if we are not seeking, not switching the tracks and not switching the quality
if (!playbackController.isSeeking() && !scheduleController.getSwitchStrack() && !qualityChangeInProgress) {
logger.info('onFragmentLoadingAbandoned request: ' + e.request.url + ' has to be downloaded again, origin is not seeking process or switch track call');

// in case of an init segment we force the download of an init segment
Expand Down

0 comments on commit 205854c

Please sign in to comment.