aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthexai <58434170+thexai@users.noreply.github.com>2024-01-27 15:21:00 +0100
committerGitHub <noreply@github.com>2024-01-27 15:21:00 +0100
commitf1caa0dc88bf290bdb348e3bab26f0c43e75296b (patch)
tree8c5e8a8315f5d83b67374934b23a1ce4e982c9e5
parentaec8e37fc02285eb4a1d665c6471088165ddff7b (diff)
parent8c3a345b1cd0fd9aa8d9dc5f5c850a0889ff1123 (diff)
Merge pull request #24583 from thexai/wasapi-fallback-Nexus
AESinkWASAPI: improve fallback when is not supported exact output channel layout
-rw-r--r--xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp
index a0e4e71f7a..cbbf084d03 100644
--- a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp
+++ b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp
@@ -731,6 +731,7 @@ bool CAESinkWASAPI::InitializeExclusive(AEAudioFormat &format)
unsigned int requestedChannels = 0;
unsigned int noOfCh = 0;
uint64_t desired_map = 0;
+ bool matchNoChannelsOnly = false;
if (SUCCEEDED(hr))
{
@@ -763,16 +764,34 @@ bool CAESinkWASAPI::InitializeExclusive(AEAudioFormat &format)
// as the last resort try stereo
if (layout == ARRAYSIZE(layoutsList))
{
- wfxex.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
- wfxex.Format.nChannels = 2;
+ if (matchNoChannelsOnly)
+ {
+ wfxex.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
+ wfxex.Format.nChannels = 2;
+ }
+ else
+ {
+ matchNoChannelsOnly = true;
+ layout = -1;
+ CLog::Log(LOGWARNING, "AESinkWASAPI: Match only number of audio channels as fallback");
+ continue;
+ }
}
else if (layout >= 0)
{
wfxex.dwChannelMask = CAESinkFactoryWin::ChLayoutToChMask(layoutsList[layout], &noOfCh);
wfxex.Format.nChannels = noOfCh;
int res = desired_map & wfxex.dwChannelMask;
- if (res != desired_map)
- continue; // output channel layout doesn't match input channels
+ if (matchNoChannelsOnly)
+ {
+ if (noOfCh < requestedChannels)
+ continue; // number of channels doesn't match requested channels
+ }
+ else
+ {
+ if (res != desired_map)
+ continue; // output channel layout doesn't match input channels
+ }
}
CAEChannelInfo foundChannels;
CAESinkFactoryWin::AEChannelsFromSpeakerMask(foundChannels, wfxex.dwChannelMask);