summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGaurav Kumar <gaurav.kumar@broadcom.com>2014-01-06 10:57:18 +0530
committerGlenn Kasten <gkasten@android.com>2014-01-29 17:46:08 +0000
commit7e79cd2d3067cdb7b9daf639cf772d4dd149c934 (patch)
treebbb14bc8c011b3c7e60c2b78c2a2f4366bf12639
parent99044adc6e209d31e9c5308d960e2bd5f6999f85 (diff)
downloadframeworks_av-7e79cd2d3067cdb7b9daf639cf772d4dd149c934.zip
frameworks_av-7e79cd2d3067cdb7b9daf639cf772d4dd149c934.tar.gz
frameworks_av-7e79cd2d3067cdb7b9daf639cf772d4dd149c934.tar.bz2
AudioMixer: Remove tracks from enabledTracks after reseting outTemp
If any track goes through AudioMixer::process__genericNoResampling, and its getnextbuffer returns NULL, Then that track is removed by AudioMixer from enabledTracks. Thus if all tracks getnextbuffer return NULL, Then this function doesn't reset outTemp and last buffer in AudioFlinger's mMixBuffer will be repeated and noise is observed. Remove tracks from enabledTracks after reseting outTemp to zero, so that process__genericNoResampling will reset outTemp and noise won't appear. Bug: 12450065 Change-Id: I1ccac7ee4a3bf7fd930254356c072099e11e7c19 Signed-off-by: Gaurav Kumar <gaurav.kumar@broadcom.com> Signed-off-by: Pierre Couillaud <pierre@broadcom.com>
-rw-r--r--services/audioflinger/AudioMixer.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index df4e029..07dc6dd 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -1122,10 +1122,6 @@ void AudioMixer::process__genericNoResampling(state_t* state, int64_t pts)
t.bufferProvider->getNextBuffer(&t.buffer, pts);
t.frameCount = t.buffer.frameCount;
t.in = t.buffer.raw;
- // t.in == NULL can happen if the track was flushed just after having
- // been enabled for mixing.
- if (t.in == NULL)
- enabledTracks &= ~(1<<i);
}
e0 = enabledTracks;
@@ -1161,6 +1157,13 @@ void AudioMixer::process__genericNoResampling(state_t* state, int64_t pts)
aux = t.auxBuffer + numFrames;
}
while (outFrames) {
+ // t.in == NULL can happen if the track was flushed just after having
+ // been enabled for mixing.
+ if (t.in == NULL) {
+ enabledTracks &= ~(1<<i);
+ e1 &= ~(1<<i);
+ break;
+ }
size_t inFrames = (t.frameCount > outFrames)?outFrames:t.frameCount;
if (inFrames) {
t.hook(&t, outTemp + (BLOCKSIZE-outFrames)*MAX_NUM_CHANNELS, inFrames,