Skip to content

Commit 6d30f61

Browse files
authored
feat: Add avoidEvictionOnQuotaExceededError config (#8031)
Related to #7349
1 parent b353224 commit 6d30f61

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

demo/config.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,9 @@ shakaDemo.Config = class {
601601
.addBoolInput_('Don\'t choose codecs',
602602
'streaming.dontChooseCodecs')
603603
.addBoolInput_('Should fix timestampOffset',
604-
'streaming.shouldFixTimestampOffset');
604+
'streaming.shouldFixTimestampOffset')
605+
.addBoolInput_('Avoid eviction on QuotaExceededError',
606+
'streaming.avoidEvictionOnQuotaExceededError');
605607
this.addRetrySection_('streaming', 'Streaming Retry Parameters');
606608
this.addLiveSyncSection_();
607609
}

externs/shaka/player.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1670,7 +1670,8 @@ shaka.extern.LiveSyncConfiguration;
16701670
* loadTimeout: number,
16711671
* clearDecodingCache: boolean,
16721672
* dontChooseCodecs: boolean,
1673-
* shouldFixTimestampOffset: boolean
1673+
* shouldFixTimestampOffset: boolean,
1674+
* avoidEvictionOnQuotaExceededError: boolean
16741675
* }}
16751676
*
16761677
* @description
@@ -1922,6 +1923,10 @@ shaka.extern.LiveSyncConfiguration;
19221923
* <br>
19231924
* Defaults to <code>false</code> except on Tizen, WebOS whose default value
19241925
* is <code>true</code>.
1926+
* @property {boolean} avoidEvictionOnQuotaExceededError
1927+
* Avoid evict content on QuotaExceededError.
1928+
* <br>
1929+
* Defaults to <code>false</code>.
19251930
* @exportDoc
19261931
*/
19271932
shaka.extern.StreamingConfiguration;

lib/media/streaming_engine.js

+8
Original file line numberDiff line numberDiff line change
@@ -1978,6 +1978,14 @@ shaka.media.StreamingEngine = class {
19781978
if (handled) {
19791979
return;
19801980
}
1981+
if (this.config_.avoidEvictionOnQuotaExceededError) {
1982+
// QuotaExceededError gets thrown if eviction didn't help to make room
1983+
// for a segment. We want to wait for a while (4 seconds is just an
1984+
// arbitrary number) before updating to give the playhead a chance to
1985+
// advance, so we don't immediately throw again.
1986+
this.scheduleUpdate_(mediaState, 4);
1987+
return;
1988+
}
19811989
// Reduction schedule: 80%, 60%, 40%, 20%, 16%, 12%, 8%, 4%, fail.
19821990
// Note: percentages are used for comparisons to avoid rounding errors.
19831991
const percentBefore = Math.round(100 * this.bufferingScale_);

lib/util/player_configuration.js

+1
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ shaka.util.PlayerConfiguration = class {
277277
dontChooseCodecs: false,
278278
shouldFixTimestampOffset: shaka.util.Platform.isWebOS() ||
279279
shaka.util.Platform.isTizen(),
280+
avoidEvictionOnQuotaExceededError: false,
280281
};
281282

282283
// WebOS, Tizen, Chromecast and Hisense have long hardware pipelines

0 commit comments

Comments
 (0)