Skip to content

Commit

Permalink
allow the device to downmix multichannel aac when surround sound supp…
Browse files Browse the repository at this point in the history
…ort is not detected
  • Loading branch information
cewert committed Sep 28, 2023
1 parent 2c6cea6 commit d2f3761
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions source/utils/deviceCapabilities.brs
Original file line number Diff line number Diff line change
Expand Up @@ -306,19 +306,7 @@ function getDeviceProfile() as object
"DirectPlayProfiles": DirectPlayProfile,
"TranscodingProfiles": [],
"ContainerProfiles": [],
"CodecProfiles": [
{
"Type": "VideoAudio",
"Conditions": [
{
"Condition": "LessThanEqual",
"Property": "AudioChannels",
"Value": maxAudioChannels,
"IsRequired": false
}
]
}
],
"CodecProfiles": [],
"SubtitleProfiles": [
{
"Format": "vtt",
Expand Down Expand Up @@ -512,9 +500,16 @@ function getDeviceProfile() as object
if maxAudioChannels = "2"
' use whatever value is reported by the device
' this will allow the device to downmix multichannel audio to stereo
channelSupportFound = false
for each audioChannel in audioChannels
if channelSupportFound
' if 8 channels are supported we don't need to test for 6 or 2
' if 6 channels are supported we don't need to test 2
exit for
end if
for each codecType in ["VideoAudio", "Audio"]
if di.CanDecodeAudio({ Codec: "aac", ChCnt: audioChannel }).Result
channelSupportFound = true
deviceProfile.CodecProfiles.push({
"Type": codecType,
"Codec": "aac",
Expand All @@ -527,15 +522,13 @@ function getDeviceProfile() as object
}
]
})
' if 8 channels are supported we don't need to test for 6 or 2
' if 6 channels are supported we don't need to test 2
exit for
end if
end for
end for
else
' set aac to 2 channels max if surround sound is supported
' this should prevent aac from downmixing to stereo
' this should prevent aac from downmixing to stereo and force
' a transcode to preserve multichannel audio
for each codecType in ["VideoAudio", "Audio"]
deviceProfile.CodecProfiles.push({
"Type": codecType,
Expand Down

0 comments on commit d2f3761

Please sign in to comment.