summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2009-09-03 03:45:52 -0700
committerEric Laurent <elaurent@google.com>2009-09-03 04:11:18 -0700
commit08d3d1d001941b396b2c5e615ab8b885eefc12b4 (patch)
treeffcd7ecd2819a5a20cb956155ae401872f8772f6 /libs
parent2dcf5dae9864c103e8f03495d58ed89a14f1020e (diff)
downloadframeworks_native-08d3d1d001941b396b2c5e615ab8b885eefc12b4.zip
frameworks_native-08d3d1d001941b396b2c5e615ab8b885eefc12b4.tar.gz
frameworks_native-08d3d1d001941b396b2c5e615ab8b885eefc12b4.tar.bz2
fix issue 2096657: Sholes: residue shutter sound heard ONCE while taking a picture AFTER the volume is turned off.
Do not ramp volume if the first frame of a track is processed after the track was stopped. In the case of very short sounds, the track stop request can be received by AudioFlinger just after the start request before the first frame is mixed by AudioMixer. In this case, the track is already in stopped state and initial volume is applied with a ramp for the first frame processed which should not be the case: initial volume change is always applied immediatelly.
Diffstat (limited to 'libs')
-rw-r--r--libs/audioflinger/AudioFlinger.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index ef71641..8cb89c3 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -1319,19 +1319,20 @@ size_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wp<Track>
mAudioMixer->setBufferProvider(track);
mAudioMixer->enable(AudioMixer::MIXING);
- int param;
- if ( track->mFillingUpStatus == Track::FS_FILLED) {
+ int param = AudioMixer::VOLUME;
+ if (track->mFillingUpStatus == Track::FS_FILLED) {
// no ramp for the first volume setting
track->mFillingUpStatus = Track::FS_ACTIVE;
if (track->mState == TrackBase::RESUMING) {
track->mState = TrackBase::ACTIVE;
param = AudioMixer::RAMP_VOLUME;
- } else {
- param = AudioMixer::VOLUME;
}
- } else {
+ } else if (cblk->server != 0) {
+ // If the track is stopped before the first frame was mixed,
+ // do not apply ramp
param = AudioMixer::RAMP_VOLUME;
}
+
mAudioMixer->setParameter(param, AudioMixer::VOLUME0, left);
mAudioMixer->setParameter(param, AudioMixer::VOLUME1, right);
mAudioMixer->setParameter(
@@ -1365,7 +1366,7 @@ size_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wp<Track>
LOGV("BUFFER TIMEOUT: remove(%d) from active list", track->name());
tracksToRemove->add(track);
}
- // For tracks using static shared memry buffer, make sure that we have
+ // For tracks using static shared memory buffer, make sure that we have
// written enough data to audio hardware before disabling the track
// NOTE: this condition with arrive before track->mRetryCount <= 0 so we
// don't care about code removing track from active list above.