aaudio: cache framesPerBurst and capacity
These do not change after opening the stream so we can
simply return a stored value and avoid querying the device.
Test: atest AAudioTests
Change-Id: I7a66c12bd695fd732194ff0a14ac9c8d9cacf923
diff --git a/media/libaaudio/src/legacy/AudioStreamLegacy.h b/media/libaaudio/src/legacy/AudioStreamLegacy.h
index fefe6e0..88ef270 100644
--- a/media/libaaudio/src/legacy/AudioStreamLegacy.h
+++ b/media/libaaudio/src/legacy/AudioStreamLegacy.h
@@ -112,6 +112,18 @@
return mFramesRead.increment(frames);
}
+ /**
+ * Get the framesPerBurst from the underlying API.
+ * @return framesPerBurst
+ */
+ virtual int32_t getFramesPerBurstFromDevice() const = 0;
+
+ /**
+ * Get the bufferCapacity from the underlying API.
+ * @return bufferCapacity in frames
+ */
+ virtual int32_t getBufferCapacityFromDevice() const = 0;
+
// This is used for exact matching by MediaMetrics. So do not change it.
// MediaMetricsConstants.h: AMEDIAMETRICS_PROP_CALLERNAME_VALUE_AAUDIO
static constexpr char kCallerName[] = "aaudio";