summaryrefslogtreecommitdiffstats
path: root/hal
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2014-07-01 20:34:45 -0700
committerEric Laurent <elaurent@google.com>2014-07-01 20:34:45 -0700
commit0de8d1f80ff3cf452e9eb867f780b22bf8c54115 (patch)
tree278c708163bc2c5b72b13f9b16aad40a36f01c12 /hal
parent20bcfa8b451941843e8eabb5308f1f04f07d347a (diff)
downloadandroid_hardware_qcom_audio-0de8d1f80ff3cf452e9eb867f780b22bf8c54115.tar.gz
android_hardware_qcom_audio-0de8d1f80ff3cf452e9eb867f780b22bf8c54115.tar.bz2
android_hardware_qcom_audio-0de8d1f80ff3cf452e9eb867f780b22bf8c54115.zip
audio: fixed channel count determination from channel mask
Do not use popcount() to derive channel count from channel mask. Bug: 15000850. Change-Id: Idaf241be22f85040c6461834bad60ae1d9244f32
Diffstat (limited to 'hal')
-rw-r--r--hal/audio_hw.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 53aed41f..46af57ff 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1819,7 +1819,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
out->usecase = USECASE_AUDIO_PLAYBACK_MULTI_CH;
out->config = pcm_config_hdmi_multi;
out->config.rate = config->sample_rate;
- out->config.channels = popcount(out->channel_mask);
+ out->config.channels = audio_channel_count_from_out_mask(out->channel_mask);
out->config.period_size = HDMI_MULTI_PERIOD_BYTES / (out->config.channels * 2);
} else if (out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) {
if (config->offload_info.version != AUDIO_INFO_INITIALIZER.version ||
@@ -1860,7 +1860,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
out->compr_config.codec->bit_rate =
config->offload_info.bit_rate;
out->compr_config.codec->ch_in =
- popcount(config->channel_mask);
+ audio_channel_count_from_out_mask(config->channel_mask);
out->compr_config.codec->ch_out = out->compr_config.codec->ch_in;
if (flags & AUDIO_OUTPUT_FLAG_NON_BLOCKING)
@@ -2160,7 +2160,7 @@ static int adev_get_mic_mute(const struct audio_hw_device *dev, bool *state)
static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev __unused,
const struct audio_config *config)
{
- int channel_count = popcount(config->channel_mask);
+ int channel_count = audio_channel_count_from_in_mask(config->channel_mask);
return get_input_buffer_size(config->sample_rate, config->format, channel_count);
}
@@ -2174,7 +2174,7 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
struct audio_device *adev = (struct audio_device *)dev;
struct stream_in *in;
int ret = 0, buffer_size, frame_size;
- int channel_count = popcount(config->channel_mask);
+ int channel_count = audio_channel_count_from_in_mask(config->channel_mask);
ALOGV("%s: enter", __func__);
*stream_in = NULL;