From cc42d2bc5f5a186f66af01560959fe0d03bfb0a3 Mon Sep 17 00:00:00 2001 From: Bertrand Berthelot Date: Wed, 29 Sep 2021 15:17:29 +0200 Subject: [PATCH 1/2] Do not update manifest if already updating (for example when MSS audio and text tracks are changed simultaneoulsy) --- src/streaming/ManifestUpdater.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/streaming/ManifestUpdater.js b/src/streaming/ManifestUpdater.js index a5c4bdb9c7..bd6e7189a5 100644 --- a/src/streaming/ManifestUpdater.js +++ b/src/streaming/ManifestUpdater.js @@ -136,6 +136,7 @@ function ManifestUpdater() { } function refreshManifest(ignorePatch = false) { + if (isUpdating) return; isUpdating = true; const manifest = manifestModel.getValue(); From 479452780d8604e5613f3a7d7ed0778b00e4001c Mon Sep 17 00:00:00 2001 From: Bertrand Berthelot Date: Wed, 29 Sep 2021 15:48:10 +0200 Subject: [PATCH 2/2] [MSS] Do not update manifest if already updating at tracks switching for live streams --- src/streaming/ManifestUpdater.js | 6 +++++- src/streaming/Stream.js | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/streaming/ManifestUpdater.js b/src/streaming/ManifestUpdater.js index bd6e7189a5..85a7558f92 100644 --- a/src/streaming/ManifestUpdater.js +++ b/src/streaming/ManifestUpdater.js @@ -136,7 +136,6 @@ function ManifestUpdater() { } function refreshManifest(ignorePatch = false) { - if (isUpdating) return; isUpdating = true; const manifest = manifestModel.getValue(); @@ -265,10 +264,15 @@ function ManifestUpdater() { isUpdating = false; } + function getIsUpdating() { + return isUpdating; + } + instance = { initialize: initialize, setManifest: setManifest, refreshManifest: refreshManifest, + getIsUpdating: getIsUpdating, setConfig: setConfig, reset: reset }; diff --git a/src/streaming/Stream.js b/src/streaming/Stream.js index 75b7a5cd60..7ccdaa7d20 100644 --- a/src/streaming/Stream.js +++ b/src/streaming/Stream.js @@ -670,9 +670,11 @@ function Stream(config) { // Applies only for MSS streams if (manifest.refreshManifestOnSwitchTrack) { - logger.debug('Stream - Refreshing manifest for switch track'); trackChangedEvents.push(e); - manifestUpdater.refreshManifest(); + if (!manifestUpdater.getIsUpdating()) { + logger.debug('Stream - Refreshing manifest for switch track'); + manifestUpdater.refreshManifest(); + } } else { processor.selectMediaInfo(mediaInfo) .then(() => {