From 281dd4e13309973dbb85bce531f884237e0d8fb0 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Fri, 20 Dec 2013 17:36:01 -0800 Subject: audioflinger: fix static track end detection If a static track is not a fast track, prepareTracks_l() must rely on framesReady() to detect end of buffer and remove the track from the active track list. Failing to do so results in the track staying active but not processed by the mixer because in underrun. This leaves the mix buffer content uninitialized and causes the effect process function to accumulate its output onto undefined data. Bug: 12013676. Change-Id: I4b0819a9d93141ac3307b8786fc6a451dd585220 --- services/audioflinger/Threads.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'services') diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index 7cc6abe..4f1c01d 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -3038,15 +3038,8 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac (mMixerStatusIgnoringFastTracks == MIXER_TRACKS_READY)) { minFrames = desiredFrames; } - // It's not safe to call framesReady() for a static buffer track, so assume it's ready - size_t framesReady; - if (track->sharedBuffer() == 0) { - framesReady = track->framesReady(); - } else if (track->isStopped()) { - framesReady = 0; - } else { - framesReady = 1; - } + + size_t framesReady = track->framesReady(); if ((framesReady >= minFrames) && track->isReady() && !track->isPaused() && !track->isTerminated()) { -- cgit v1.1