aaudio: lower latency using MMAP capture
MMAP can be enabled by setting system properties.
Bug: 38267780
Test: input_monitor.cpp
Change-Id: I5e86fd1d9baef4fe59837ccbca7971acbb54d8b5
Signed-off-by: Phil Burk <philburk@google.com>
diff --git a/media/libaaudio/src/client/AudioEndpoint.h b/media/libaaudio/src/client/AudioEndpoint.h
index 3a2099f..53ba033 100644
--- a/media/libaaudio/src/client/AudioEndpoint.h
+++ b/media/libaaudio/src/client/AudioEndpoint.h
@@ -54,29 +54,36 @@
*/
aaudio_result_t writeDataNow(const void *buffer, int32_t numFrames);
- void getEmptyRoomAvailable(android::WrappingBuffer *wrappingBuffer);
+ void getEmptyFramesAvailable(android::WrappingBuffer *wrappingBuffer);
int32_t getEmptyFramesAvailable();
+
+ void getFullFramesAvailable(android::WrappingBuffer *wrappingBuffer);
+
int32_t getFullFramesAvailable();
+ void advanceReadIndex(int32_t deltaFrames);
+
void advanceWriteIndex(int32_t deltaFrames);
/**
* Set the read index in the downData queue.
* This is needed if the reader is not updating the index itself.
*/
- void setDownDataReadCounter(android::fifo_counter_t framesRead);
- android::fifo_counter_t getDownDataReadCounter();
+ void setDataReadCounter(android::fifo_counter_t framesRead);
- void setDownDataWriteCounter(android::fifo_counter_t framesWritten);
- android::fifo_counter_t getDownDataWriteCounter();
+ android::fifo_counter_t getDataReadCounter();
+
+ void setDataWriteCounter(android::fifo_counter_t framesWritten);
+
+ android::fifo_counter_t getDataWriteCounter();
/**
* The result is not valid until after configure() is called.
*
* @return true if the output buffer read position is not updated, eg. DMA
*/
- bool isOutputFreeRunning() const { return mOutputFreeRunning; }
+ bool isFreeRunning() const { return mFreeRunning; }
int32_t setBufferSizeInFrames(int32_t requestedFrames,
int32_t *actualFrames);
@@ -86,8 +93,8 @@
private:
android::FifoBuffer *mUpCommandQueue;
- android::FifoBuffer *mDownDataQueue;
- bool mOutputFreeRunning;
+ android::FifoBuffer *mDataQueue;
+ bool mFreeRunning;
android::fifo_counter_t mDataReadCounter; // only used if free-running
android::fifo_counter_t mDataWriteCounter; // only used if free-running
};