From 8c27e46bb92319bd8b9451814a1b82920541edba Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Thu, 18 Jul 2024 17:03:53 -0700 Subject: [PATCH] audio: Restrict reported channel masks to "mono" and "stereo" When translating supported channel counts into channel masks, only use channel layouts for 1 and 2 channels: "mono" and "stereo", while reporting all other counts via indexed masks. This helps to support output to multichannel USB Audio interfaces properly. Bug: 329571487 Test: repro steps in the bug Change-Id: Ibbbf71e7f04a6622cccaddeb3f4f140193d7f8fb --- audio/aidl/default/alsa/Utils.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/audio/aidl/default/alsa/Utils.cpp b/audio/aidl/default/alsa/Utils.cpp index c08836c3d6..8eaf162aa8 100644 --- a/audio/aidl/default/alsa/Utils.cpp +++ b/audio/aidl/default/alsa/Utils.cpp @@ -80,11 +80,8 @@ static AudioChannelCountToMaskMap make_ChannelCountToMaskMap( const AudioChannelCountToMaskMap& getSupportedChannelOutLayoutMap() { static const std::set supportedOutChannelLayouts = { - DEFINE_CHANNEL_LAYOUT_MASK(MONO), DEFINE_CHANNEL_LAYOUT_MASK(STEREO), - DEFINE_CHANNEL_LAYOUT_MASK(2POINT1), DEFINE_CHANNEL_LAYOUT_MASK(QUAD), - DEFINE_CHANNEL_LAYOUT_MASK(PENTA), DEFINE_CHANNEL_LAYOUT_MASK(5POINT1), - DEFINE_CHANNEL_LAYOUT_MASK(6POINT1), DEFINE_CHANNEL_LAYOUT_MASK(7POINT1), - DEFINE_CHANNEL_LAYOUT_MASK(7POINT1POINT4), DEFINE_CHANNEL_LAYOUT_MASK(22POINT2), + DEFINE_CHANNEL_LAYOUT_MASK(MONO), + DEFINE_CHANNEL_LAYOUT_MASK(STEREO), }; static const AudioChannelCountToMaskMap outLayouts = make_ChannelCountToMaskMap(supportedOutChannelLayouts);