Skip to content
Browse files

[WIN32][AE] fixed: DirectSound supports more than 2 channels.

  • Loading branch information...
1 parent abb9a90 commit 04314035eff13e7e6805eb482fecb5bfd05be055 wsoltys committed
Showing with 1 addition and 1 deletion.
  1. +1 −1 xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp
2 xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp
@@ -603,7 +603,7 @@ void CAESinkDirectSound::EnumerateDevicesEx(AEDeviceInfoList &deviceInfoList, bo
if (SUCCEEDED(hr) && varName.blob.cbSize > 0)
WAVEFORMATEX* smpwfxex = (WAVEFORMATEX*)varName.blob.pBlobData;
- deviceInfo.m_channels = layoutsByChCount[std::min(smpwfxex->nChannels, (WORD) 2)];
+ deviceInfo.m_channels = layoutsByChCount[std::min(smpwfxex->nChannels, (WORD) 8)];
deviceInfo.m_sampleRates.push_back(std::min(smpwfxex->nSamplesPerSec, (DWORD) 96000));

3 comments on commit 0431403

Team Kodi member

@wsoltys Nice catch! But it should be fixed as "std::max( ... , 2)"
This is intended to use mono devices and devices with unknown number of channels as stereo devices.

Team Kodi member

I have to admit that video/audio isn't my terrain and I just try to dig into it. PKEY_AudioEngine_DeviceFormat returns us what the user has selected not what the hw is capable of. Since the layoutsByChCount array is limited to 9 entries it should be guarded. As layoutsByChCount has a valid entry for 1 channel (AE_CH_FC) I thought it would be okay.
@DDDamian: thoughts?


You're both right:

  • it should be guarded to protect against layouts greater than the layoutByChCount array
  • it should never be mono (the channel remapper will force mono -> stereo regardless, so having a mono output here would be bad).
Please sign in to comment.
Something went wrong with that request. Please try again.