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 /audio/AudioHardwareStub.cpp | |
parent | 03d92f4a6ec954cfa81765f00c1784e2c2ff2f49 (diff) | |
download | platform_hardware_libhardware_legacy-40508f66cacca49688b85540c79a2ddc3d96d13d.tar.gz platform_hardware_libhardware_legacy-40508f66cacca49688b85540c79a2ddc3d96d13d.tar.bz2 platform_hardware_libhardware_legacy-40508f66cacca49688b85540c79a2ddc3d96d13d.zip |
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 'audio/AudioHardwareStub.cpp')
-rw-r--r-- | audio/AudioHardwareStub.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/audio/AudioHardwareStub.cpp b/audio/AudioHardwareStub.cpp index 1083889..fd647d5 100644 --- a/audio/AudioHardwareStub.cpp +++ b/audio/AudioHardwareStub.cpp @@ -128,7 +128,8 @@ status_t AudioStreamOutStub::set(int *pFormat, uint32_t *pChannels, uint32_t *pR ssize_t AudioStreamOutStub::write(const void* buffer, size_t bytes) { // fake timing for audio output - usleep(bytes * 1000000 / sizeof(int16_t) / AudioSystem::popCount(channels()) / sampleRate()); + usleep(bytes * 1000000 / sizeof(int16_t) / + audio_channel_count_from_out_mask(channels()) / sampleRate()); return bytes; } @@ -174,7 +175,8 @@ status_t AudioStreamInStub::set(int *pFormat, uint32_t *pChannels, uint32_t *pRa ssize_t AudioStreamInStub::read(void* buffer, ssize_t bytes) { // fake timing for audio input - usleep(bytes * 1000000 / sizeof(int16_t) / AudioSystem::popCount(channels()) / sampleRate()); + usleep(bytes * 1000000 / sizeof(int16_t) / + audio_channel_count_from_in_mask(channels()) / sampleRate()); memset(buffer, 0, bytes); return bytes; } |