aaudio: suspend a stream when its queue is full
This will prevent log spam when AAUDIO_CALLBACK_RESULT_STOP
is returned from an audio callback.
Bug: 120845500
Test: test_return_stop.cpp
Change-Id: Icfe1541d6fa7b045285ac3dfbb75dfed5424d49b
diff --git a/services/oboeservice/AAudioServiceStreamBase.cpp b/services/oboeservice/AAudioServiceStreamBase.cpp
index 354b36a..defbb7b 100644
--- a/services/oboeservice/AAudioServiceStreamBase.cpp
+++ b/services/oboeservice/AAudioServiceStreamBase.cpp
@@ -179,6 +179,7 @@
}
setFlowing(false);
+ setSuspended(false);
// Start with fresh presentation timestamps.
mAtomicTimestamp.clear();
@@ -345,7 +346,9 @@
}
int32_t count = mUpMessageQueue->getFifoBuffer()->write(command, 1);
if (count != 1) {
- ALOGE("%s(): Queue full. Did client die? %s", __func__, getTypeText());
+ ALOGW("%s(): Queue full. Did client stop? Suspending stream. what = %u, %s",
+ __func__, command->what, getTypeText());
+ setSuspended(true);
return AAUDIO_ERROR_WOULD_BLOCK;
} else {
return AAUDIO_OK;