aaudio: use xruns detected in the service
The service knows when an actual xrun occurs so we pass
that value to the client.
Bug: 38512417
Test: write_sine_callback -pl -n1 -s20 -c2 -u
Change-Id: I9e5ff1edd2e9378957309280162d7cda855f5adb
diff --git a/media/libaaudio/src/client/AudioStreamInternalPlay.cpp b/media/libaaudio/src/client/AudioStreamInternalPlay.cpp
index 1cf2c72..063c5d8 100644
--- a/media/libaaudio/src/client/AudioStreamInternalPlay.cpp
+++ b/media/libaaudio/src/client/AudioStreamInternalPlay.cpp
@@ -140,7 +140,8 @@
}
// If the read index passed the write index then consider it an underrun.
- if (mAudioEndpoint.getFullFramesAvailable() < 0) {
+ // For shared streams, the xRunCount is passed up from the service.
+ if (mAudioEndpoint.isFreeRunning() && mAudioEndpoint.getFullFramesAvailable() < 0) {
mXRunCount++;
if (ATRACE_ENABLED()) {
ATRACE_INT("aaUnderRuns", mXRunCount);