summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Tracks.cpp
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2013-10-17 11:32:39 -0700
committerGlenn Kasten <gkasten@google.com>2013-10-17 11:33:31 -0700
commit12022ff8d223ccf4dfae019c81e4a93a3f44985c (patch)
treeba799e32b0699249e7fb8e6f5d6fa4120b978d67 /services/audioflinger/Tracks.cpp
parentf8f15b05fe051009945c9042a1a9260280e0feb2 (diff)
downloadframeworks_av-12022ff8d223ccf4dfae019c81e4a93a3f44985c.zip
frameworks_av-12022ff8d223ccf4dfae019c81e4a93a3f44985c.tar.gz
frameworks_av-12022ff8d223ccf4dfae019c81e4a93a3f44985c.tar.bz2
Fix flush() followed by start()
Bug: 11259166 Change-Id: I72526cdfd4e3ff4b06e6a317e577f57cc285205d
Diffstat (limited to 'services/audioflinger/Tracks.cpp')
-rw-r--r--services/audioflinger/Tracks.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 9c6e724..e93833f 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -600,6 +600,15 @@ status_t AudioFlinger::PlaybackThread::Track::start(AudioSystem::sync_event_t ev
// track was already in the active list, not a problem
if (status == ALREADY_EXISTS) {
status = NO_ERROR;
+ } else {
+ // Acknowledge any pending flush(), so that subsequent new data isn't discarded.
+ // It is usually unsafe to access the server proxy from a binder thread.
+ // But in this case we know the mixer thread (whether normal mixer or fast mixer)
+ // isn't looking at this track yet: we still hold the normal mixer thread lock,
+ // and for fast tracks the track is not yet in the fast mixer thread's active set.
+ ServerProxy::Buffer buffer;
+ buffer.mFrameCount = 1;
+ (void) mAudioTrackServerProxy->obtainBuffer(&buffer);
}
} else {
status = BAD_VALUE;