diff options
author | Glenn Kasten <gkasten@google.com> | 2011-12-15 15:32:27 -0800 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2011-12-16 13:22:41 -0800 |
commit | 237a624f674800d2300806b115eee8c9bb7db033 (patch) | |
tree | edf7370358ef705903fe8ba8abfb7f0103d76ed5 /services/audioflinger/AudioMixer.cpp | |
parent | 154a7fbda9b704bc1d23b6f17573016ebb5989be (diff) | |
download | frameworks_av-237a624f674800d2300806b115eee8c9bb7db033.zip frameworks_av-237a624f674800d2300806b115eee8c9bb7db033.tar.gz frameworks_av-237a624f674800d2300806b115eee8c9bb7db033.tar.bz2 |
deleteTrackName now asserts on bad input parameter
This is safe, as the input parameter is always track->name(),
which must be valid.
Change-Id: Iea8ea3a5706c27026335526ba8851030d00681f8
Diffstat (limited to 'services/audioflinger/AudioMixer.cpp')
-rw-r--r-- | services/audioflinger/AudioMixer.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp index 1ebcd26..c6dd40b 100644 --- a/services/audioflinger/AudioMixer.cpp +++ b/services/audioflinger/AudioMixer.cpp @@ -124,24 +124,23 @@ void AudioMixer::invalidateState(uint32_t mask) void AudioMixer::deleteTrackName(int name) { name -= TRACK0; - if (uint32_t(name) < MAX_NUM_TRACKS) { - ALOGV("deleteTrackName(%d)", name); - track_t& track(mState.tracks[ name ]); - if (track.enabled != 0) { - track.enabled = 0; - invalidateState(1<<name); - } - if (track.resampler) { - // delete the resampler - delete track.resampler; - track.resampler = NULL; - track.sampleRate = mSampleRate; - invalidateState(1<<name); - } - track.volumeInc[0] = 0; - track.volumeInc[1] = 0; - mTrackNames &= ~(1<<name); + assert(uint32_t(name) < MAX_NUM_TRACKS); + ALOGV("deleteTrackName(%d)", name); + track_t& track(mState.tracks[ name ]); + if (track.enabled != 0) { + track.enabled = 0; + invalidateState(1<<name); + } + if (track.resampler) { + // delete the resampler + delete track.resampler; + track.resampler = NULL; + track.sampleRate = mSampleRate; + invalidateState(1<<name); } + track.volumeInc[0] = 0; + track.volumeInc[1] = 0; + mTrackNames &= ~(1<<name); } void AudioMixer::enable() |