AudioFlinger: flush direct tracks that are paused

Normally the flush is processed on ObtainBuffer.
But that is not called when the track is paused.
So it was not possible to flush and re-prime a
track that was paused.

Now we flush synchronously for inactive tracks,
and flush from prepareTracks_l for active tracks.

Bug: 19193985
Bug: 27791443
Change-Id: I39a7e4921e45041c3a51cf91fd3995b5edee6dd4
Signed-off-by: Phil Burk <philburk@google.com>
diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h
index ffdb9b5..7becf57 100644
--- a/include/private/media/AudioTrackShared.h
+++ b/include/private/media/AudioTrackShared.h
@@ -522,6 +522,12 @@
         mTimestampMutator.push(timestamp);
     }
 
+    // Flushes the shared ring buffer if the client had requested it using mStreaming.mFlush.
+    // If flush occurs then:
+    //   cblk->u.mStreaming.mFront, ServerProxy::mFlush and ServerProxy::mFlushed will be modified
+    //   client will be notified via Futex
+    virtual void    flushBufferIfNeeded();
+
     // Total count of the number of flushed frames since creation (never reset).
     virtual int64_t     framesFlushed() const { return mFlushed; }