diff options
author | Eric Laurent <elaurent@google.com> | 2019-05-01 18:07:29 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2019-05-01 18:09:25 -0700 |
commit | 154055d2bce6311f03e5ac06e8ba417375b24817 (patch) | |
tree | 02bef2541d47d53faf52159d49e1d26f08c2648b /hal | |
parent | 8c373e4c415df9698377de20b5202243a5c9c377 (diff) | |
download | audio-154055d2bce6311f03e5ac06e8ba417375b24817.tar.gz |
audio hal: report index channel masks for USB
Report only index channel masks for USB output profiles
supporting more than two channels.
Bug: 120947396
Test: play multichannel audio over USB
Change-Id: I10f6d4751a5a17674d24fb0d074f1dd6a71a06e1
Diffstat (limited to 'hal')
-rw-r--r-- | hal/audio_hw.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c index 2807bcc..517351e 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -1300,11 +1300,8 @@ static int read_usb_sup_channel_masks(bool is_playback, } if (is_playback) { // start from 2 channels as framework currently doesn't support mono. - // TODO: consider only supporting channel index masks beyond stereo here. - for (channel_count = FCC_2; - channel_count <= channels && num_masks < max_masks; - ++channel_count) { - supported_channel_masks[num_masks++] = audio_channel_out_mask_from_count(channel_count); + if (channels >= FCC_2) { + supported_channel_masks[num_masks++] = audio_channel_out_mask_from_count(FCC_2); } for (channel_count = FCC_2; channel_count <= channels && num_masks < max_masks; @@ -1318,9 +1315,11 @@ static int read_usb_sup_channel_masks(bool is_playback, // audio_channel_in_mask_from_count() does the right conversion to either positional or // indexed mask for ( ; channel_count <= channels && num_masks < max_masks; channel_count++) { - const audio_channel_mask_t mask = - audio_channel_in_mask_from_count(channel_count); - supported_channel_masks[num_masks++] = mask; + audio_channel_mask_t mask = AUDIO_CHANNEL_NONE; + if (channel_count <= FCC_2) { + mask = audio_channel_in_mask_from_count(channel_count); + supported_channel_masks[num_masks++] = mask; + } const audio_channel_mask_t index_mask = audio_channel_mask_for_index_assignment_from_count(channel_count); if (mask != index_mask && num_masks < max_masks) { // ensure index mask added. |