From 9ea0466eda2d0af7ad49ebd655b8573e3430e253 Mon Sep 17 00:00:00 2001 From: Charles Ewert Date: Wed, 27 Sep 2023 21:27:31 -0400 Subject: [PATCH] don't add aac directly to transcode profile when surround sound is supported --- source/utils/deviceCapabilities.brs | 103 ++++++++++++++-------------- 1 file changed, 52 insertions(+), 51 deletions(-) diff --git a/source/utils/deviceCapabilities.brs b/source/utils/deviceCapabilities.brs index 17a4aae23..0911ad9a0 100644 --- a/source/utils/deviceCapabilities.brs +++ b/source/utils/deviceCapabilities.brs @@ -396,57 +396,10 @@ function getDeviceProfile() as object "Protocol": "http", "MaxAudioChannels": maxAudioChannels }) - ' add aac to TranscodingProfile for stereo audio - ' NOTE: multichannel aac is not supported. only decode to stereo on some devices - deviceProfile.TranscodingProfiles.push({ - "Container": "ts", - "Type": "Audio", - "AudioCodec": "aac", - "Context": "Streaming", - "Protocol": "http", - "MaxAudioChannels": "2" - }) - deviceProfile.TranscodingProfiles.push({ - "Container": "ts", - "Type": "Audio", - "AudioCodec": "aac", - "Context": "Static", - "Protocol": "http", - "MaxAudioChannels": "2" - }) - - tsArray = { - "Container": "ts", - "Context": "Streaming", - "Protocol": "hls", - "Type": "Video", - "AudioCodec": tsAudioCodecs, - "VideoCodec": tsVideoCodecs, - "MaxAudioChannels": maxAudioChannels, - "MinSegments": 1, - "BreakOnNonKeyFrames": false - } - mp4Array = { - "Container": "mp4", - "Context": "Streaming", - "Protocol": "hls", - "Type": "Video", - "AudioCodec": mp4AudioCodecs, - "VideoCodec": mp4VideoCodecs, - "MaxAudioChannels": maxAudioChannels, - "MinSegments": 1, - "BreakOnNonKeyFrames": false - } - - ' apply max res to transcoding profile - if maxResSetting <> "off" - tsArray.Conditions = [maxVideoHeightArray, maxVideoWidthArray] - mp4Array.Conditions = [maxVideoHeightArray, maxVideoWidthArray] - end if - ' surround sound - if surroundSoundCodec <> invalid - ' add preferred surround sound codec to TranscodingProfile + ' set preferred audio codec for transcoding + if isValid(surroundSoundCodec) + ' use preferred surround sound codec deviceProfile.TranscodingProfiles.push({ "Container": surroundSoundCodec, "Type": "Audio", @@ -464,7 +417,7 @@ function getDeviceProfile() as object "MaxAudioChannels": maxAudioChannels }) - ' put codec in front of AudioCodec string + ' put preferred surround sound codec in the front of AudioCodec strings if tsArray.AudioCodec = "" tsArray.AudioCodec = surroundSoundCodec else @@ -476,6 +429,54 @@ function getDeviceProfile() as object else mp4Array.AudioCodec = surroundSoundCodec + "," + mp4Array.AudioCodec end if + else + ' add aac for stereo audio. + ' stereo aac is supported on all devices + deviceProfile.TranscodingProfiles.push({ + "Container": "ts", + "Type": "Audio", + "AudioCodec": "aac", + "Context": "Streaming", + "Protocol": "http", + "MaxAudioChannels": "2" + }) + deviceProfile.TranscodingProfiles.push({ + "Container": "ts", + "Type": "Audio", + "AudioCodec": "aac", + "Context": "Static", + "Protocol": "http", + "MaxAudioChannels": "2" + }) + end if + + tsArray = { + "Container": "ts", + "Context": "Streaming", + "Protocol": "hls", + "Type": "Video", + "AudioCodec": tsAudioCodecs, + "VideoCodec": tsVideoCodecs, + "MaxAudioChannels": maxAudioChannels, + "MinSegments": 1, + "BreakOnNonKeyFrames": false + } + mp4Array = { + "Container": "mp4", + "Context": "Streaming", + "Protocol": "hls", + "Type": "Video", + "AudioCodec": mp4AudioCodecs, + "VideoCodec": mp4VideoCodecs, + "MaxAudioChannels": maxAudioChannels, + "MinSegments": 1, + "BreakOnNonKeyFrames": false + } + + ' apply max res to transcoding profile + if maxResSetting <> "off" + tsArray.Conditions = [maxVideoHeightArray, maxVideoWidthArray] + mp4Array.Conditions = [maxVideoHeightArray, maxVideoWidthArray] end if deviceProfile.TranscodingProfiles.push(tsArray)