diff options
author | Glenn Kasten <gkasten@google.com> | 2011-12-16 07:30:14 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-12-16 07:30:14 -0800 |
commit | f96272c3cdb3c3f6177d3fcd29e597e10dc2040f (patch) | |
tree | 510e4f1987864b81d2b148056ace43a3b594b698 | |
parent | 844756be54681dd96b822558b136367e459e5e6a (diff) | |
parent | afb40b5fcfd9565be11d34eca243f4d054b92e97 (diff) | |
download | frameworks_base-f96272c3cdb3c3f6177d3fcd29e597e10dc2040f.zip frameworks_base-f96272c3cdb3c3f6177d3fcd29e597e10dc2040f.tar.gz frameworks_base-f96272c3cdb3c3f6177d3fcd29e597e10dc2040f.tar.bz2 |
Merge "setActiveTrack and setBufferProvider can't fail"
-rw-r--r-- | services/audioflinger/AudioMixer.cpp | 15 | ||||
-rw-r--r-- | services/audioflinger/AudioMixer.h | 4 |
2 files changed, 9 insertions, 10 deletions
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp index f302b2f..1ebcd26 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> @@ -161,13 +162,12 @@ void AudioMixer::disable() } } -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) @@ -324,10 +324,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; } diff --git a/services/audioflinger/AudioMixer.h b/services/audioflinger/AudioMixer.h index 02722d7..f380b35 100644 --- a/services/audioflinger/AudioMixer.h +++ b/services/audioflinger/AudioMixer.h @@ -80,10 +80,10 @@ public: void enable(); void disable(); - status_t setActiveTrack(int track); + void setActiveTrack(int track); status_t setParameter(int target, int name, void *value); - status_t setBufferProvider(AudioBufferProvider* bufferProvider); + void setBufferProvider(AudioBufferProvider* bufferProvider); void process(); uint32_t trackNames() const { return mTrackNames; } |