Enable FastTrack timestamps

Bug: 26413951
Change-Id: Id54c32cb0f0be83d443f6cf1007181ebc461c586
diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h
index 2270c85..aa9e98c 100644
--- a/include/private/media/AudioTrackShared.h
+++ b/include/private/media/AudioTrackShared.h
@@ -315,6 +315,19 @@
     // See documentation for AudioTrack.setBufferSizeInFrames()
     size_t      setBufferSizeInFrames(size_t requestedSize);
 
+    status_t    getTimestamp(ExtendedTimestamp *timestamp) {
+        if (timestamp == nullptr) {
+            return BAD_VALUE;
+        }
+        (void) mTimestampObserver.poll(mTimestamp);
+        *timestamp = mTimestamp;
+        return OK;
+    }
+
+    void        clearTimestamp() {
+        mTimestamp.clear();
+    }
+
 protected:
     // This is set by AudioTrack.setBufferSizeInFrames().
     // A write will not fill the buffer above this limit.
@@ -322,6 +335,12 @@
 
 private:
     Modulo<uint32_t> mEpoch;
+
+    // The shared buffer contents referred to by the timestamp observer
+    // is initialized when the server proxy created.  A local zero timestamp
+    // is initialized by the client constructor.
+    ExtendedTimestampQueue::Observer mTimestampObserver;
+    ExtendedTimestamp mTimestamp; // initialized by constructor
 };
 
 // ----------------------------------------------------------------------------
@@ -333,7 +352,9 @@
             size_t frameSize, bool clientInServer = false)
         : ClientProxy(cblk, buffers, frameCount, frameSize, true /*isOut*/,
           clientInServer),
-          mPlaybackRateMutator(&cblk->mPlaybackRateQueue) { }
+          mPlaybackRateMutator(&cblk->mPlaybackRateQueue) {
+    }
+
     virtual ~AudioTrackClientProxy() { }
 
     // No barriers on the following operations, so the ordering of loads/stores
@@ -431,23 +452,9 @@
     AudioRecordClientProxy(audio_track_cblk_t* cblk, void *buffers, size_t frameCount,
             size_t frameSize)
         : ClientProxy(cblk, buffers, frameCount, frameSize,
-            false /*isOut*/, false /*clientInServer*/)
-        , mTimestampObserver(&cblk->mExtendedTimestampQueue) { }
+            false /*isOut*/, false /*clientInServer*/) { }
     ~AudioRecordClientProxy() { }
 
-    status_t    getTimestamp(ExtendedTimestamp *timestamp) {
-        if (timestamp == nullptr) {
-            return BAD_VALUE;
-        }
-        (void) mTimestampObserver.poll(mTimestamp);
-        *timestamp = mTimestamp;
-        return OK;
-    }
-
-    void        clearTimestamp() {
-        mTimestamp.clear();
-    }
-
     // Advances the client read pointer to the server write head pointer
     // effectively flushing the client read buffer. The effect is
     // instantaneous. Returns the number of frames flushed.
@@ -457,13 +464,6 @@
         android_atomic_release_store(rear, &mCblk->u.mStreaming.mFront);
         return (Modulo<int32_t>(rear) - front).unsignedValue();
     }
-
-private:
-    // The shared buffer contents referred to by the timestamp observer
-    // is initialized when the server proxy created.  A local zero timestamp
-    // is initialized by the client constructor.
-    ExtendedTimestampQueue::Observer mTimestampObserver;
-    ExtendedTimestamp mTimestamp; // initialized by constructor
 };
 
 // ----------------------------------------------------------------------------
@@ -509,10 +509,20 @@
     //  buffer->mRaw is NULL.
     virtual void        releaseBuffer(Buffer* buffer);
 
+    // Return the total number of frames that AudioFlinger has obtained and released
+    virtual int64_t     framesReleased() const { return mReleased; }
+
+    // Expose timestamp to client proxy. Should only be called by a single thread.
+    virtual void        setTimestamp(const ExtendedTimestamp &timestamp) {
+        mTimestampMutator.push(timestamp);
+    }
+
 protected:
     size_t      mAvailToClient; // estimated frames available to client prior to releaseBuffer()
     int32_t     mFlush;         // our copy of cblk->u.mStreaming.mFlush, for streaming output only
     int64_t     mReleased;      // our copy of cblk->mServer, at 64 bit resolution
+
+    ExtendedTimestampQueue::Mutator mTimestampMutator;
 };
 
 // Proxy used by AudioFlinger for servicing AudioTrack
@@ -556,9 +566,6 @@
     // and thus which resulted in an underrun.
     virtual uint32_t    getUnderrunFrames() const { return mCblk->u.mStreaming.mUnderrunFrames; }
 
-    // Return the total number of frames that AudioFlinger has obtained and released
-    virtual size_t      framesReleased() const { return mReleased; }
-
     // Return the playback speed and pitch read atomically. Not multi-thread safe on server side.
     AudioPlaybackRate getPlaybackRate();
 
@@ -611,20 +618,10 @@
 public:
     AudioRecordServerProxy(audio_track_cblk_t* cblk, void *buffers, size_t frameCount,
             size_t frameSize, bool clientInServer)
-        : ServerProxy(cblk, buffers, frameCount, frameSize, false /*isOut*/, clientInServer)
-        , mTimestampMutator(&cblk->mExtendedTimestampQueue) { }
+        : ServerProxy(cblk, buffers, frameCount, frameSize, false /*isOut*/, clientInServer) { }
 
-    // Return the total number of frames that AudioFlinger has obtained and released
-    virtual int64_t     framesReleased() const { return mReleased; }
-
-    // Expose timestamp to client proxy. Should only be called by a single thread.
-    virtual void        setExtendedTimestamp(const ExtendedTimestamp &timestamp) {
-                            mTimestampMutator.push(timestamp);
-                        }
 protected:
     virtual ~AudioRecordServerProxy() { }
-
-    ExtendedTimestampQueue::Mutator       mTimestampMutator;
 };
 
 // ----------------------------------------------------------------------------