diff options
author | Glenn Kasten <gkasten@google.com> | 2011-12-15 15:46:46 -0800 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2011-12-15 15:55:51 -0800 |
commit | fba380a0b2c62684ce4272a05165965bae29d6a1 (patch) | |
tree | d0a89a2c45aa09a838c5f93108a3be8f5a80d4e5 /services/audioflinger/AudioMixer.cpp | |
parent | eebeceec684a36222b4559e3157b0db04c0a67ed (diff) | |
download | frameworks_av-fba380a0b2c62684ce4272a05165965bae29d6a1.zip frameworks_av-fba380a0b2c62684ce4272a05165965bae29d6a1.tar.gz frameworks_av-fba380a0b2c62684ce4272a05165965bae29d6a1.tar.bz2 |
setActiveTrack and setBufferProvider can't fail
Return void, not status_t, from setActiveTrack and setBufferProvider.
These methods returned status_t, but the callers never checked the
return value. Since these aren't externally visible APIs, they now
return void, and assert on bad input parameters.
Change-Id: I530ed29484596ae41e8659826ca425149c51c2a1
Diffstat (limited to 'services/audioflinger/AudioMixer.cpp')
-rw-r--r-- | services/audioflinger/AudioMixer.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp index 7c7fa56..74db59e 100644 --- a/services/audioflinger/AudioMixer.cpp +++ b/services/audioflinger/AudioMixer.cpp @@ -18,6 +18,7 @@ #define LOG_TAG "AudioMixer" //#define LOG_NDEBUG 0 +#include <assert.h> #include <stdint.h> #include <string.h> #include <stdlib.h> @@ -169,13 +170,12 @@ status_t AudioMixer::disable(int name) return NO_ERROR; } -status_t AudioMixer::setActiveTrack(int track) +void AudioMixer::setActiveTrack(int track) { - if (uint32_t(track-TRACK0) >= MAX_NUM_TRACKS) { - return BAD_VALUE; - } - mActiveTrack = track - TRACK0; - return NO_ERROR; + // this also catches track < TRACK0 + track -= TRACK0; + assert(uint32_t(track) < MAX_NUM_TRACKS); + mActiveTrack = track; } status_t AudioMixer::setParameter(int target, int name, void *value) @@ -332,10 +332,9 @@ void AudioMixer::track_t::adjustVolumeRamp(bool aux) } -status_t AudioMixer::setBufferProvider(AudioBufferProvider* buffer) +void AudioMixer::setBufferProvider(AudioBufferProvider* buffer) { mState.tracks[ mActiveTrack ].bufferProvider = buffer; - return NO_ERROR; } |