Report data from aaudio mmap path to audio flinger.
Report data from aaudio mmap path to audio flinger for sound dose
computation. A shared memory is allocated for read and write counter.
The client will shared the write counter with the aaudio service. The
command thread will wake up every 5 burst time to report the data to
audio flinger.
Test: atest AAudioTests
Test: test_marshalling
Test: dump wav file in audio flinger and play
Bug: 264254430
Change-Id: Ib732442c5afc9169fe891212cf77b458c41a87f1
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 163e2a0..c617ef7 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -9823,6 +9823,10 @@
return mThread->standby();
}
+status_t AudioFlinger::MmapThreadHandle::reportData(const void* buffer, size_t frameCount) {
+ return mThread->reportData(buffer, frameCount);
+}
+
AudioFlinger::MmapThread::MmapThread(
const sp<AudioFlinger>& audioFlinger, audio_io_handle_t id,
@@ -10133,6 +10137,11 @@
return NO_ERROR;
}
+status_t AudioFlinger::MmapThread::reportData(const void* /*buffer*/, size_t /*frameCount*/) {
+ // This is a stub implementation. The MmapPlaybackThread overrides this function.
+ return INVALID_OPERATION;
+}
+
void AudioFlinger::MmapThread::readHalParameters_l()
{
@@ -10815,6 +10824,13 @@
return status;
}
+status_t AudioFlinger::MmapPlaybackThread::reportData(const void* buffer, size_t frameCount) {
+ // TODO(264254430): send the data to mel processor.
+ (void) buffer;
+ (void) frameCount;
+ return NO_ERROR;
+}
+
void AudioFlinger::MmapPlaybackThread::dumpInternals_l(int fd, const Vector<String16>& args)
{
MmapThread::dumpInternals_l(fd, args);