From 2cd48516019aee55dc4f5f53fdf5bc882c25f67f Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 22 Sep 2018 16:51:45 -0700 Subject: [PATCH] Improve PortAudio channel autodetection algorithm to workaround PulseAudio issues --- app/streaming/audio/renderers/portaudiorenderer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/streaming/audio/renderers/portaudiorenderer.cpp b/app/streaming/audio/renderers/portaudiorenderer.cpp index f6732d67..70bb8e79 100644 --- a/app/streaming/audio/renderers/portaudiorenderer.cpp +++ b/app/streaming/audio/renderers/portaudiorenderer.cpp @@ -151,7 +151,12 @@ int PortAudioRenderer::detectAudioConfiguration() return false; } - if (deviceInfo->maxOutputChannels > 2) { + // PulseAudio reports max output channels that don't + // correspond to any output devices (32 channels), so + // only use 5.1 surround sound if the output channel count + // is reasonable. Additionally, PortAudio doesn't do remixing + // for quadraphonic, so only use 5.1 if we have 6 or more channels. + if (deviceInfo->maxOutputChannels == 6 || deviceInfo->maxOutputChannels == 8) { return AUDIO_CONFIGURATION_51_SURROUND; } else {