aaudio: fix intermittent hang and position error
Fix hang caused by recursive mutex.
Fix disconnect caused by getPosition() failing, which was
just because the stream wasn't ready yet.
Bug: 63775537
Bug: 63709749
Test: run "aaudio_loopback -pl -Pl -c2 -n6 -te -m" many times
Change-Id: Ic1d54360b55cfc8ecc1809584c262bc0976c58bb
diff --git a/services/oboeservice/AAudioServiceStreamBase.cpp b/services/oboeservice/AAudioServiceStreamBase.cpp
index e0f6ad4..5f7d179 100644
--- a/services/oboeservice/AAudioServiceStreamBase.cpp
+++ b/services/oboeservice/AAudioServiceStreamBase.cpp
@@ -219,6 +219,8 @@
// (long long) command.timestamp.timestamp);
command.what = AAudioServiceMessage::code::TIMESTAMP;
result = writeUpMessageQueue(&command);
+ } else if (result == AAUDIO_ERROR_UNAVAILABLE) {
+ result = AAUDIO_OK; // just not available yet, try again later
}
return result;
}