aaudio: stop buzzing when MMAP stream disconnected
When a stream is disconnected, clear the MMAP memory
buffer to prevent the hardware from looping on stale data
and making a buzzing sound.
Bug: 63342351
Test: play GStomper with AAudio through headphones and then unplug them
Change-Id: I6372b0a031dea242e3830cc2d226a4c043d4467e
diff --git a/media/libaaudio/src/client/AudioEndpoint.cpp b/media/libaaudio/src/client/AudioEndpoint.cpp
index 6ec285f..6ae5379 100644
--- a/media/libaaudio/src/client/AudioEndpoint.cpp
+++ b/media/libaaudio/src/client/AudioEndpoint.cpp
@@ -254,3 +254,7 @@
ALOGD("AudioEndpoint: data readCounter = %lld", (long long) mDataQueue->getReadCounter());
ALOGD("AudioEndpoint: data writeCounter = %lld", (long long) mDataQueue->getWriteCounter());
}
+
+void AudioEndpoint::eraseDataMemory() {
+ mDataQueue->eraseMemory();
+}