aaudio: set to SHARED when EXCLUSIVE fails
SHARED streams and endpoints were being created with sharing mode
set to EXCLUSIVE. This was confusing the close() code and caused a hang.
Now we create a modified Request object with the sharing mode set
correctly.
Bug: 112709847
Test: Hack AAudioServiceEndpointMMAP so isBufferShareable is false.
Test: 'adb shell write_sine_callback -pl -x -s2' should not hang.
Change-Id: I7a5c8260beaffdd706f34d35ef00a61b072adb1d
diff --git a/services/oboeservice/AAudioServiceStreamBase.cpp b/services/oboeservice/AAudioServiceStreamBase.cpp
index 9af8af3..12be4a3 100644
--- a/services/oboeservice/AAudioServiceStreamBase.cpp
+++ b/services/oboeservice/AAudioServiceStreamBase.cpp
@@ -81,8 +81,7 @@
return result.str();
}
-aaudio_result_t AAudioServiceStreamBase::open(const aaudio::AAudioStreamRequest &request,
- aaudio_sharing_mode_t sharingMode) {
+aaudio_result_t AAudioServiceStreamBase::open(const aaudio::AAudioStreamRequest &request) {
AAudioEndpointManager &mEndpointManager = AAudioEndpointManager::getInstance();
aaudio_result_t result = AAUDIO_OK;
@@ -109,8 +108,7 @@
// referenced until the service returns a handle to the client.
// So only one thread can open a stream.
mServiceEndpoint = mEndpointManager.openEndpoint(mAudioService,
- request,
- sharingMode);
+ request);
if (mServiceEndpoint == nullptr) {
ALOGE("%s() openEndpoint() failed", __func__);
result = AAUDIO_ERROR_UNAVAILABLE;