Add getExternalPosition in MMapStreamInterface.
GetExternalPosition will return a recent count of the number of
audio frames presented/received to/from an external observer. Using
the new API can return a precise timestamp to client, which can
help on A/V sync.
Test: atest AAudioTests
Bug: 158609200
Change-Id: If74e1d859a2bb2b4dba6af0e4e9164f05d19d962
diff --git a/include/media/MmapStreamInterface.h b/include/media/MmapStreamInterface.h
index b3bf16d..61de987 100644
--- a/include/media/MmapStreamInterface.h
+++ b/include/media/MmapStreamInterface.h
@@ -22,6 +22,8 @@
#include <utils/Errors.h>
#include <utils/RefBase.h>
+#include <time.h>
+
namespace android {
class MmapStreamCallback;
@@ -103,6 +105,19 @@
virtual status_t getMmapPosition(struct audio_mmap_position *position) = 0;
/**
+ * Get a recent count of the number of audio frames presented/received to/from an
+ * external observer.
+ *
+ * \param[out] position count of presented audio frames
+ * \param[out] timeNanos associated clock time
+ *
+ * \return OK if the external position is set correctly.
+ * NO_INIT in case of initialization error
+ * INVALID_OPERATION if the interface is not implemented
+ */
+ virtual status_t getExternalPosition(uint64_t* position, int64_t* timeNanos) = 0;
+
+ /**
* Start a stream operating in mmap mode.
* createMmapBuffer() must be called before calling start()
*