summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorGaurav Kumar <gaurav.kumar@broadcom.com>2014-01-06 10:57:18 +0530
committerEric Laurent <elaurent@google.com>2014-03-05 13:59:28 -0800
commitabab1c33caf0982c11713e6d64d60105dcbc8ab7 (patch)
treefed18cdc3a9543b56ffeaf73db55d0d20ee937e9 /services
parentd0115d8c4db2f337030dea706bc0a434c4a03ed6 (diff)
downloadframeworks_av-abab1c33caf0982c11713e6d64d60105dcbc8ab7.zip
frameworks_av-abab1c33caf0982c11713e6d64d60105dcbc8ab7.tar.gz
frameworks_av-abab1c33caf0982c11713e6d64d60105dcbc8ab7.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: I28996d425838728955f01eb1a00acf6e6dc2dea1 Signed-off-by: Gaurav Kumar <gaurav.kumar@broadcom.com> Signed-off-by: Pierre Couillaud <pierre@broadcom.com>
Diffstat (limited to 'services')
-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,