Skip to content

Commit

Permalink
Be more permissive of text failures
Browse files Browse the repository at this point in the history
Now, the ignoreTextStreamFailures config applies to parsing errors as
well as network errors.

We also no longer count text streams against the startup phase.  Early
text failures will not prevent StreamingEngine from switching, without
regard for the presence of the ignoreTextStreamFailures config.

Issue #635

Change-Id: I6818ef021beabfbc8742a7b013fa0424b77cff47
  • Loading branch information
joeyparrish committed Jan 6, 2017
1 parent 3e9cd2f commit 3ee875a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/media/streaming_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,13 @@ shaka.media.StreamingEngine.prototype.fetchAndAppend_ = function(
this.handleQuotaExceeded_(mediaState, error);
} else {
shaka.log.error(logPrefix, 'failed fetch and append: code=' + error.code);
this.onError_(error);
if (mediaState.type == 'text' && this.config_.ignoreTextStreamFailures) {
shaka.log.warning(logPrefix,
'Text stream failed to parse. Proceeding without it.');
delete this.mediaStates_['text'];
} else {
this.onError_(error);
}
}
}.bind(this));
};
Expand All @@ -1160,7 +1166,8 @@ shaka.media.StreamingEngine.prototype.handleNetworkError_ = function(
var logPrefix = shaka.media.StreamingEngine.logPrefix_(mediaState);
if (mediaState.type == 'text' && this.config_.ignoreTextStreamFailures &&
error.code == shaka.util.Error.Code.BAD_HTTP_STATUS) {
shaka.log.warning(logPrefix, 'Text stream failed. Proceeding without it.');
shaka.log.warning(logPrefix,
'Text stream failed to download. Proceeding without it.');
delete this.mediaStates_['text'];
} else {
this.onError_(error);
Expand Down Expand Up @@ -1404,7 +1411,8 @@ shaka.media.StreamingEngine.prototype.handleStartup_ = function(
var mediaStates = MapUtils.values(this.mediaStates_);
this.startupComplete_ = mediaStates.every(function(ms) {
// Startup completes once we have buffered at least one segment from each
// MediaState.
// MediaState, not counting text.
if (ms.type == 'text') return true;
return !ms.waitingToClearBuffer &&
!ms.clearingBuffer &&
ms.lastSegmentReference;
Expand Down

0 comments on commit 3ee875a

Please sign in to comment.