From 60f4f4774f5778c2d46ad82fcd2c095771428467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=CC=81lvaro=20Velad=20Galva=CC=81n?= Date: Wed, 22 Jan 2025 17:23:03 +0100 Subject: [PATCH] fix: Avoid setAppendWindow when the window is Infinity --- lib/media/media_source_engine.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/media/media_source_engine.js b/lib/media/media_source_engine.js index e245be02da..8d690e3de2 100644 --- a/lib/media/media_source_engine.js +++ b/lib/media/media_source_engine.js @@ -1570,20 +1570,24 @@ shaka.media.MediaSourceEngine = class { null)); } } - operations.push(this.enqueueOperation_( - contentType, - () => this.setAppendWindow_( - contentType, appendWindowStart, appendWindowEnd), - null)); - if (this.needSplitMuxedContent_) { + if (appendWindowStart != 0 || appendWindowEnd != Infinity) { operations.push(this.enqueueOperation_( - ContentType.AUDIO, + contentType, () => this.setAppendWindow_( - ContentType.AUDIO, appendWindowStart, appendWindowEnd), + contentType, appendWindowStart, appendWindowEnd), null)); + if (this.needSplitMuxedContent_) { + operations.push(this.enqueueOperation_( + ContentType.AUDIO, + () => this.setAppendWindow_( + ContentType.AUDIO, appendWindowStart, appendWindowEnd), + null)); + } } - await Promise.all(operations); + if (operations.length) { + await Promise.all(operations); + } } /**