aaudio: teardown stream based on a port handle
Needed for silencing specific input streams.
Pass AAudioService reference into AAudioServiceEndpointMMAP.
Use it to find a specific stream by PortHandle then
stop it and disconnect it.
Bug: 72134552
Test: b/72134552#comment10
Change-Id: Ibdf242f834c83b47c967c3cc634ed1083b019d4a
diff --git a/media/libaaudio/src/client/AudioStreamInternal.cpp b/media/libaaudio/src/client/AudioStreamInternal.cpp
index 0bdfeac..9204824 100644
--- a/media/libaaudio/src/client/AudioStreamInternal.cpp
+++ b/media/libaaudio/src/client/AudioStreamInternal.cpp
@@ -392,19 +392,25 @@
}
aaudio_result_t AudioStreamInternal::startClient(const android::AudioClient& client,
- audio_port_handle_t *clientHandle) {
+ audio_port_handle_t *portHandle) {
+ ALOGV("%s() called", __func__);
if (mServiceStreamHandle == AAUDIO_HANDLE_INVALID) {
return AAUDIO_ERROR_INVALID_STATE;
}
-
- return mServiceInterface.startClient(mServiceStreamHandle, client, clientHandle);
+ aaudio_result_t result = mServiceInterface.startClient(mServiceStreamHandle,
+ client, portHandle);
+ ALOGV("%s(%d) returning %d", __func__, *portHandle, result);
+ return result;
}
-aaudio_result_t AudioStreamInternal::stopClient(audio_port_handle_t clientHandle) {
+aaudio_result_t AudioStreamInternal::stopClient(audio_port_handle_t portHandle) {
+ ALOGV("%s(%d) called", __func__, portHandle);
if (mServiceStreamHandle == AAUDIO_HANDLE_INVALID) {
return AAUDIO_ERROR_INVALID_STATE;
}
- return mServiceInterface.stopClient(mServiceStreamHandle, clientHandle);
+ aaudio_result_t result = mServiceInterface.stopClient(mServiceStreamHandle, portHandle);
+ ALOGV("%s(%d) returning %d", __func__, portHandle, result);
+ return result;
}
aaudio_result_t AudioStreamInternal::getTimestamp(clockid_t clockId,