Merge "pal: return correct channel mask depending on channel count"
diff --git a/device/src/USBAudio.cpp b/device/src/USBAudio.cpp
index 072ebd2..5c40793 100644
--- a/device/src/USBAudio.cpp
+++ b/device/src/USBAudio.cpp
@@ -774,16 +774,12 @@
channels = MAX_HIFI_CHANNEL_COUNT;
if (is_playback) {
- // start from 2 channels as framework currently doesn't support mono.
- if (channels >= 2) {
- channel[num_masks++] = audio_channel_out_mask_from_count(2);
- }
- for (channel_count = 2;
- channel_count <= channels && num_masks < MAX_SUPPORTED_CHANNEL_MASKS;
- ++channel_count) {
- channel[num_masks++] =
- audio_channel_mask_for_index_assignment_from_count(channel_count);
- }
+ channel[num_masks++] = channels <= 2
+ /* position mask for mono and stereo*/
+ ? audio_channel_out_mask_from_count(channels)
+ /* otherwise indexed */
+ : audio_channel_mask_for_index_assignment_from_count(channels);
+ // TODO: needs to figure out the accurate match of channel mask
} else {
// For capture we report all supported channel masks from 1 channel up.
channel_count = MIN_CHANNEL_COUNT;