Don't use control block frame count after create

This is part of a series to clean up the control block.

Change-Id: I7f4cb05aef63053f8e2ab05b286d302260ef4758
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index f1b26b5..61214ec 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -510,7 +510,9 @@
 
     float                   mVolume[2];
     float                   mSendLevel;
-    uint32_t                mFrameCount;
+    size_t                  mFrameCount;            // corresponds to current IAudioTrack
+    size_t                  mReqFrameCount;         // frame count to request the next time a new
+                                                    // IAudioTrack is needed
 
     audio_track_cblk_t*     mCblk;                  // re-load after mLock.unlock()
 
diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h
index bbc5e26..48b6b21 100644
--- a/include/private/media/AudioTrackShared.h
+++ b/include/private/media/AudioTrackShared.h
@@ -55,7 +55,10 @@
 
                 int         mPad1;          // unused, but preserves cache line alignment
 
-                uint32_t    frameCount;
+                size_t      frameCount_;    // used during creation to pass actual track buffer size
+                                            // from AudioFlinger to client, and not referenced again
+                                            // FIXME remove here and replace by createTrack() in/out parameter
+                                            // renamed to "_" to detect incorrect use
 
                 // Cache line boundary (32 bytes)
 
@@ -97,19 +100,23 @@
 
                 // called by client only, where client includes regular
                 // AudioTrack and AudioFlinger::PlaybackThread::OutputTrack
-                uint32_t    stepUserIn(uint32_t frameCount) { return stepUser(frameCount, false); }
-                uint32_t    stepUserOut(uint32_t frameCount) { return stepUser(frameCount, true); }
+                uint32_t    stepUserIn(size_t stepCount, size_t frameCount) { return stepUser(stepCount, frameCount, false); }
+                uint32_t    stepUserOut(size_t stepCount, size_t frameCount) { return stepUser(stepCount, frameCount, true); }
 
-                bool        stepServer(uint32_t frameCount, bool isOut);
+                bool        stepServer(size_t stepCount, size_t frameCount, bool isOut);
 
                 // if there is a shared buffer, "buffers" is the value of pointer() for the shared
                 // buffer, otherwise "buffers" points immediately after the control block
                 void*       buffer(void *buffers, uint32_t frameSize, uint32_t offset) const;
 
-                uint32_t    framesAvailableIn() { return framesAvailable(false); }
-                uint32_t    framesAvailableOut() { return framesAvailable(true); }
-                uint32_t    framesAvailableIn_l() { return framesAvailable_l(false); }
-                uint32_t    framesAvailableOut_l() { return framesAvailable_l(true); }
+                uint32_t    framesAvailableIn(size_t frameCount)
+                                { return framesAvailable(frameCount, false); }
+                uint32_t    framesAvailableOut(size_t frameCount)
+                                { return framesAvailable(frameCount, true); }
+                uint32_t    framesAvailableIn_l(size_t frameCount)
+                                { return framesAvailable_l(frameCount, false); }
+                uint32_t    framesAvailableOut_l(size_t frameCount)
+                                { return framesAvailable_l(frameCount, true); }
                 uint32_t    framesReadyIn() { return framesReady(false); }
                 uint32_t    framesReadyOut() { return framesReady(true); }
 
@@ -140,9 +147,9 @@
 
 private:
                 // isOut == true means AudioTrack, isOut == false means AudioRecord
-                uint32_t    stepUser(uint32_t frameCount, bool isOut);
-                uint32_t    framesAvailable(bool isOut);
-                uint32_t    framesAvailable_l(bool isOut);
+                uint32_t    stepUser(size_t stepCount, size_t frameCount, bool isOut);
+                uint32_t    framesAvailable(size_t frameCount, bool isOut);
+                uint32_t    framesAvailable_l(size_t frameCount, bool isOut);
                 uint32_t    framesReady(bool isOut);
 };