summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaynes Mathew George <hgeorge@codeaurora.org>2015-03-11 18:25:50 -0700
committerAndy Hung <hunga@google.com>2015-03-16 10:47:09 -0700
commit240934ba80d6c6165749db7681d243c6857a092f (patch)
treeed11373a97a1e0815e6949dc4f7d08d449a6fecc
parent1a86a8adbf4ab43a6aed2c3c8aa0830c001adb77 (diff)
downloadframeworks_av-240934ba80d6c6165749db7681d243c6857a092f.zip
frameworks_av-240934ba80d6c6165749db7681d243c6857a092f.tar.gz
frameworks_av-240934ba80d6c6165749db7681d243c6857a092f.tar.bz2
audioflinger: refresh fast track underrun state upon start
False underrun is detected when starting recycled fast tracks, which leads to continuous fatal assertion failures and even AP reboot. Track's last mObservedUnderruns isn't updated one at previous stop() call. Hence, when we start the same track again, we should synchronize it to the latest state instead of relying on stale one. authored-by: Weiyin Jiang<wjiang@codeaurora.org> CRs-Fixed: 803389 Bug: 19635137 Signed-off-by: Andy Hung <hunga@google.com> Change-Id: Ia003a49c6896dba965798c062c98b8c367ef8369
-rw-r--r--services/audioflinger/Tracks.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 8329be4..38667b9 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -444,8 +444,6 @@ AudioFlinger::PlaybackThread::Track::Track(
// this means we are potentially denying other more important fast tracks from
// being created. It would be better to allocate the index dynamically.
mFastIndex = i;
- // Read the initial underruns because this field is never cleared by the fast mixer
- mObservedUnderruns = thread->getFastTrackUnderruns(i);
thread->mFastTrackAvailMask &= ~(1 << i);
}
}
@@ -694,6 +692,12 @@ status_t AudioFlinger::PlaybackThread::Track::start(AudioSystem::sync_event_t ev
}
PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
+ if (isFastTrack()) {
+ // refresh fast track underruns on start because that field is never cleared
+ // by the fast mixer; furthermore, the same track can be recycled, i.e. start
+ // after stop.
+ mObservedUnderruns = playbackThread->getFastTrackUnderruns(mFastIndex);
+ }
status = playbackThread->addTrack_l(this);
if (status == INVALID_OPERATION || status == PERMISSION_DENIED) {
triggerEvents(AudioSystem::SYNC_EVENT_PRESENTATION_COMPLETE);