From 5e33b983a59e83e48edc70e2c4a18183cd0e4361 Mon Sep 17 00:00:00 2001 From: dmitrylyzo <56478732+dmitrylyzo@users.noreply.github.com> Date: Sat, 7 Sep 2024 18:07:30 -0400 Subject: [PATCH] Backport pull request #5972 from jellyfin-web/release-10.9.z Apply Maximum Allowed Audio Channels to DirectPlay Original-merge: 20ea6041a76bd1d6b2eee0b2ab3c16579a172984 Merged-by: thornbill Backported-by: Joshua M. Boniface --- src/scripts/browserDeviceProfile.js | 44 +++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js index e41289acb5..019ab78073 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -906,17 +906,45 @@ export default function (options) { }); } + const globalAudioCodecProfileConditions = []; + const globalVideoAudioCodecProfileConditions = []; + + if (parseInt(userSettings.allowedAudioChannels(), 10) > 0) { + globalAudioCodecProfileConditions.push({ + Condition: 'LessThanEqual', + Property: 'AudioChannels', + Value: physicalAudioChannels.toString(), + IsRequired: false + }); + + globalVideoAudioCodecProfileConditions.push({ + Condition: 'LessThanEqual', + Property: 'AudioChannels', + Value: physicalAudioChannels.toString(), + IsRequired: false + }); + } + if (!supportsSecondaryAudio) { + globalVideoAudioCodecProfileConditions.push({ + Condition: 'Equals', + Property: 'IsSecondaryAudio', + Value: 'false', + IsRequired: false + }); + } + + if (globalAudioCodecProfileConditions.length) { + profile.CodecProfiles.push({ + Type: 'Audio', + Conditions: globalAudioCodecProfileConditions + }); + } + + if (globalVideoAudioCodecProfileConditions.length) { profile.CodecProfiles.push({ Type: 'VideoAudio', - Conditions: [ - { - Condition: 'Equals', - Property: 'IsSecondaryAudio', - Value: 'false', - IsRequired: false - } - ] + Conditions: globalVideoAudioCodecProfileConditions }); }