Skip to content

Commit b8a1823

Browse files
tykus160avelad
authored andcommitted
fix: Fix infinite evict loop on text unload (#9331)
Steps to retroduce: 1. Load content with CEA captions 2. Enable subtitles 3. Disable subtitles 4. Wait for a few minutes - application will hang due to recursive callbacks on text unload. Issue is a regression introduced by combination of #7360 & #9068
1 parent a85373c commit b8a1823

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/media/streaming_engine.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2697,6 +2697,9 @@ shaka.media.StreamingEngine = class {
26972697
* @private
26982698
*/
26992699
async evict_(mediaState, presentationTime) {
2700+
if (this.lastTextMediaStateBeforeUnload_ == mediaState) {
2701+
this.lastTextMediaStateBeforeUnload_ = null;
2702+
}
27002703
const segmentIndex = mediaState.stream.segmentIndex;
27012704
/** @type {Array<number>} */
27022705
let continuityTimelines;
@@ -2723,9 +2726,6 @@ shaka.media.StreamingEngine = class {
27232726
const startTime =
27242727
this.playerInterface_.mediaSourceEngine.bufferStart(mediaState.type);
27252728
if (startTime == null) {
2726-
if (this.lastTextMediaStateBeforeUnload_ == mediaState) {
2727-
this.lastTextMediaStateBeforeUnload_ = null;
2728-
}
27292729
shaka.log.v2(logPrefix,
27302730
'buffer behind okay because nothing buffered:',
27312731
'presentationTime=' + presentationTime,

0 commit comments

Comments
 (0)