aaudio: fix CTS for MMAP mode
Improve calculation of buffer capacity based on requested minimum.
Adjust timing of start() to reduce underflows.
Track ServiceEndpoints based on requested deviceId.
Fix getFramesRead() and flush() behavior.
Fix timeouts due to ClockModel lateness bug.
Misc cleanup.
Bug: 37755299
Test: test_aaudio.cpp
Change-Id: I637c16e87fbe14b6f28c60aeea0b9dfed965ecd0
diff --git a/services/oboeservice/AAudioServiceStreamShared.h b/services/oboeservice/AAudioServiceStreamShared.h
index dfdbbb3..35af434 100644
--- a/services/oboeservice/AAudioServiceStreamShared.h
+++ b/services/oboeservice/AAudioServiceStreamShared.h
@@ -97,6 +97,14 @@
aaudio_result_t getFreeRunningPosition(int64_t *positionFrames, int64_t *timeNanos) override;
+ /**
+ * @param requestedCapacityFrames
+ * @param framesPerBurst
+ * @return capacity or negative error
+ */
+ static int32_t calculateBufferCapacity(int32_t requestedCapacityFrames,
+ int32_t framesPerBurst);
+
private:
android::AAudioService &mAudioService;
AAudioServiceEndpoint *mServiceEndpoint = nullptr;