diff options
author | Andy Hung <hunga@google.com> | 2018-10-29 18:31:12 -0700 |
---|---|---|
committer | Andy Hung <hunga@google.com> | 2018-10-29 18:51:16 -0700 |
commit | 88ce1d930fa55e08dd5056cbc2b1d79bd2e65224 (patch) | |
tree | 4c30036bffe4c866f01ced1f1154d412d68955af /hal/audio_hw.c | |
parent | f5f2cc582f153ae88009a2a88072db5b2a4dcd81 (diff) | |
download | android_hardware_qcom_audio-88ce1d930fa55e08dd5056cbc2b1d79bd2e65224.tar.gz android_hardware_qcom_audio-88ce1d930fa55e08dd5056cbc2b1d79bd2e65224.tar.bz2 android_hardware_qcom_audio-88ce1d930fa55e08dd5056cbc2b1d79bd2e65224.zip |
Add USB input channel index masks
Test: Attach various multichannel USB devices, check audio policy dumpsys
Bug: 74110332
Change-Id: I9a2d8ab235efcebc129a060d2ee6d6519d5e53dd
Diffstat (limited to 'hal/audio_hw.c')
-rw-r--r-- | hal/audio_hw.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c index 3425eb9f..0e92bfe4 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -1130,8 +1130,14 @@ 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++) { - supported_channel_masks[num_masks++] = + const audio_channel_mask_t 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. + supported_channel_masks[num_masks++] = index_mask; + } } } #ifdef NDEBUG @@ -5002,7 +5008,10 @@ static int adev_open_input_stream(struct audio_hw_device *dev, devices, flags, source); - ALOGV("%s: enter", __func__); + ALOGV("%s: enter: flags %#x, is_usb_dev %d, may_use_hifi_record %d," + " sample_rate %u, channel_mask %#x, format %#x", + __func__, flags, is_usb_dev, may_use_hifi_record, + config->sample_rate, config->channel_mask, config->format); *stream_in = NULL; if (is_usb_dev && !is_usb_ready(adev, false /* is_playback */)) { @@ -5057,7 +5066,7 @@ static int adev_open_input_stream(struct audio_hw_device *dev, in->capture_handle = handle; in->flags = flags; - ALOGV("%s: source = %d, config->channel_mask = %d", __func__, source, config->channel_mask); + ALOGV("%s: source %d, config->channel_mask %#x", __func__, source, config->channel_mask); if (source == AUDIO_SOURCE_VOICE_UPLINK || source == AUDIO_SOURCE_VOICE_DOWNLINK) { /* Force channel config requested to mono if incall |