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/utility/MonotonicCounter.h b/media/libaaudio/src/utility/MonotonicCounter.h
index 5833eab..63add4e 100644
--- a/media/libaaudio/src/utility/MonotonicCounter.h
+++ b/media/libaaudio/src/utility/MonotonicCounter.h
@@ -41,10 +41,12 @@
}
/**
- * set the current value of the counter
+ * advance the current value to match the counter
*/
- void set(int64_t counter) {
- mCounter64 = counter;
+ void catchUpTo(int64_t counter) {
+ if ((counter - mCounter64) > 0) {
+ mCounter64 = counter;
+ }
}
/**