Fix AudioTrack::flush()
It was only flushing at a surface level, and even then only the first time
the server observed the client's flush request. Now it flushes at a
deeper level, but there may be even deeper device-specific flushing.
Bug: 9770947
Change-Id: I687cc3410ff9e5e5d4a5dcb9e3b129501e53d247
diff --git a/media/libmedia/AudioTrackShared.cpp b/media/libmedia/AudioTrackShared.cpp
index 5f8f292..6bb4ff7 100644
--- a/media/libmedia/AudioTrackShared.cpp
+++ b/media/libmedia/AudioTrackShared.cpp
@@ -388,6 +388,8 @@
if (flush != mFlush) {
front = rear;
mFlush = flush;
+ // effectively obtain then release whatever is in the buffer
+ android_atomic_release_store(rear, &cblk->u.mStreaming.mFront);
} else {
front = cblk->u.mStreaming.mFront;
}