aaudio: fix framesWritten for Legacy INPUT

Was set to 2X framesRead on stop.
It turns out that AudioRecord::stop() does NOT reset getPosition()
to zero. But AudioRecord::start() does.
So the logic handling the reset had to move to the start code.

Bug: 121196899
Test: test_return_stop -i -n
Change-Id: I93635f9ba501b71b99b1df34c7920f7bfea5ca88
diff --git a/media/libaaudio/src/legacy/AudioStreamTrack.cpp b/media/libaaudio/src/legacy/AudioStreamTrack.cpp
index c995e99..ff95aed 100644
--- a/media/libaaudio/src/legacy/AudioStreamTrack.cpp
+++ b/media/libaaudio/src/legacy/AudioStreamTrack.cpp
@@ -323,8 +323,8 @@
     }
 
     setState(AAUDIO_STREAM_STATE_STOPPING);
-    incrementFramesRead(getFramesWritten() - getFramesRead()); // TODO review
-    mTimestampPosition.set(getFramesWritten());
+    mFramesRead.catchUpTo(getFramesWritten());
+    mTimestampPosition.catchUpTo(getFramesWritten());
     mFramesRead.reset32(); // service reads frames, service position reset on stop
     mTimestampPosition.reset32();
     mAudioTrack->stop();