Move start/stopClient to command queue.
If the two methods is called from external to a service stream, it
should be protected by the lock and executed from the command thread.
The reason is that the two methods will access the endpoint, it will
cause race condition if it is not protected by the lock.
Bug: 341627085
Test: atest AAudioTests
Test: OboeTester disconnect test
Flag: com.android.media.aaudio.start_stop_client_from_command_thread
Change-Id: I8708e19332bc89389158fe3eda5b99f814e4fa22
diff --git a/services/oboeservice/AAudioServiceStreamMMAP.h b/services/oboeservice/AAudioServiceStreamMMAP.h
index 42032d7..f4ce83d 100644
--- a/services/oboeservice/AAudioServiceStreamMMAP.h
+++ b/services/oboeservice/AAudioServiceStreamMMAP.h
@@ -93,7 +93,13 @@
* Device specific startup.
* @return AAUDIO_OK or negative error.
*/
- aaudio_result_t startDevice() override;
+ aaudio_result_t startDevice_l() REQUIRES(mLock) override;
+
+ aaudio_result_t startClient_l(const android::AudioClient& client,
+ const audio_attributes_t *attr,
+ audio_port_handle_t *clientHandle) REQUIRES(mLock) override;
+
+ aaudio_result_t stopClient_l(audio_port_handle_t clientHandle) REQUIRES(mLock) override;
private: