summaryrefslogtreecommitdiffstats
path: root/services/audioflinger
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2015-03-17 22:50:13 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-03-17 22:50:14 +0000
commita1a847a509c5670276568d9945509677d92507ed (patch)
tree040a4e6c97488ca5f775ce3395d719ea90d45b14 /services/audioflinger
parent4604458dfe57b0e91a464aefafea50ae7b9876c1 (diff)
parent240934ba80d6c6165749db7681d243c6857a092f (diff)
downloadframeworks_av-a1a847a509c5670276568d9945509677d92507ed.zip
frameworks_av-a1a847a509c5670276568d9945509677d92507ed.tar.gz
frameworks_av-a1a847a509c5670276568d9945509677d92507ed.tar.bz2
Merge "audioflinger: refresh fast track underrun state upon start"
Diffstat (limited to 'services/audioflinger')
-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);