diff options
author | Eric Laurent <elaurent@google.com> | 2014-07-01 20:33:36 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2014-07-01 20:33:36 -0700 |
commit | 40508f66cacca49688b85540c79a2ddc3d96d13d (patch) | |
tree | cee3577bfe5a536184c436dada0effe9e5aba71d /include/hardware_legacy/AudioHardwareInterface.h | |
parent | 03d92f4a6ec954cfa81765f00c1784e2c2ff2f49 (diff) | |
download | hardware_libhardware_legacy-40508f66cacca49688b85540c79a2ddc3d96d13d.zip hardware_libhardware_legacy-40508f66cacca49688b85540c79a2ddc3d96d13d.tar.gz hardware_libhardware_legacy-40508f66cacca49688b85540c79a2ddc3d96d13d.tar.bz2 |
audio: fixed channel count determination from channel mask
Do not use popcount() to derive channel count from channel mask.
Bug: 15000850.
Change-Id: I5050ce7fd7884369eb0de37967e40052630006a9
Diffstat (limited to 'include/hardware_legacy/AudioHardwareInterface.h')
-rw-r--r-- | include/hardware_legacy/AudioHardwareInterface.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/hardware_legacy/AudioHardwareInterface.h b/include/hardware_legacy/AudioHardwareInterface.h index f5b38ea..d37da11 100644 --- a/include/hardware_legacy/AudioHardwareInterface.h +++ b/include/hardware_legacy/AudioHardwareInterface.h @@ -69,7 +69,8 @@ public: /** * return the frame size (number of bytes per sample). */ - uint32_t frameSize() const { return popcount(channels())*((format()==AUDIO_FORMAT_PCM_16_BIT)?sizeof(int16_t):sizeof(int8_t)); } + uint32_t frameSize() const { return audio_channel_count_from_out_mask(channels())* + ((format()==AUDIO_FORMAT_PCM_16_BIT)?sizeof(int16_t):sizeof(int8_t)); } /** * return the audio hardware driver latency in milli seconds. @@ -145,7 +146,8 @@ public: /** * return the frame size (number of bytes per sample). */ - uint32_t frameSize() const { return AudioSystem::popCount(channels())*((format()==AudioSystem::PCM_16_BIT)?sizeof(int16_t):sizeof(int8_t)); } + uint32_t frameSize() const { return audio_channel_count_from_in_mask(channels())* + ((format()==AudioSystem::PCM_16_BIT)?sizeof(int16_t):sizeof(int8_t)); } /** set the input gain for the audio driver. This method is for * for future use */ |