From 7807f8f062f9e1aa368e2f53ae76b2fc3d9bab7c Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Mon, 26 Aug 2024 22:23:46 +0300 Subject: [PATCH] Apply Maximum Allowed Audio Channels to DirectPlay --- 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 f14ac31617d..90c1c65e2bd 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -875,17 +875,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 }); }