From b491e4a23fae1b7a826384362ccf5b22e66aaa19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Wed, 29 Jan 2025 10:38:53 +0100 Subject: [PATCH] fix: Use audio label on ExampleBasedCriteria (#7971) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes https://github.com/shaka-project/shaka-player/issues/7968 --------- Co-authored-by: Wojciech TyczyƄski --- lib/media/example_based_criteria.js | 7 ++++--- lib/player.js | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/media/example_based_criteria.js b/lib/media/example_based_criteria.js index b3fd3e969a..eaf9c274f3 100644 --- a/lib/media/example_based_criteria.js +++ b/lib/media/example_based_criteria.js @@ -22,10 +22,11 @@ shaka.media.ExampleBasedCriteria = class { * } adaptationSetCriteriaFactory */ constructor(example, codecSwitchingStrategy, adaptationSetCriteriaFactory) { - // We can't know if role and label are really important, so we don't use - // role and label for this. + // We can't know if role and video label are really important, so we don't + // use role and video label for this. const role = ''; - const audioLabel = ''; + const audioLabel = example.audio && example.audio.label ? + example.audio.label : ''; const videoLabel = ''; const hdrLevel = example.video && example.video.hdr ? example.video.hdr : ''; diff --git a/lib/player.js b/lib/player.js index 62cb622908..16995812fd 100644 --- a/lib/player.js +++ b/lib/player.js @@ -5187,7 +5187,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget { if (this.config_.abr.enabled && (active.video != variant.video || (active.audio && variant.audio && active.audio.language == variant.audio.language && - active.audio.channelsCount == variant.audio.channelsCount))) { + active.audio.channelsCount == variant.audio.channelsCount && + active.audio.label == variant.audio.label))) { shaka.log.alwaysWarn('Changing tracks while abr manager is enabled ' + 'will likely result in the selected track ' + 'being overridden. Consider disabling abr ' +