diff options
-rw-r--r-- | services/audioflinger/AudioMixer.cpp | 11 |
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, |