Add AudioDeviceVector to MMAP path
This CL adds AudioDeviceVector in the MMAP interface between
AudioFlinger and AAudioService.
Bug: 367816690
Test: OboeTester Test Output
Flag: android.media.audio.routed_device_ids
Change-Id: Ib658a36e91ee9f0336a59855d33cb326497a1bdc
diff --git a/services/oboeservice/AAudioServiceEndpointMMAP.cpp b/services/oboeservice/AAudioServiceEndpointMMAP.cpp
index d663f37..398068d 100644
--- a/services/oboeservice/AAudioServiceEndpointMMAP.cpp
+++ b/services/oboeservice/AAudioServiceEndpointMMAP.cpp
@@ -206,12 +206,17 @@
__func__, config->format, config->sample_rate,
config->channel_mask, deviceId);
+ android::DeviceIdVector deviceIds;
+ if (deviceId != AAUDIO_UNSPECIFIED) {
+ deviceIds.push_back(deviceId);
+ }
+
const std::lock_guard<std::mutex> lock(mMmapStreamLock);
const status_t status = MmapStreamInterface::openMmapStream(streamDirection,
&attributes,
config,
mMmapClient,
- &deviceId,
+ &deviceIds,
&sessionId,
this, // callback
mMmapStream,
@@ -228,6 +233,7 @@
config->channel_mask = currentConfig.channel_mask;
return AAUDIO_ERROR_UNAVAILABLE;
}
+ deviceId = android::getFirstDeviceId(deviceIds);
if (deviceId == AAUDIO_UNSPECIFIED) {
ALOGW("%s() - openMmapStream() failed to set deviceId", __func__);
@@ -476,8 +482,9 @@
}
};
-void AAudioServiceEndpointMMAP::onRoutingChanged(audio_port_handle_t portHandle) {
- const auto deviceId = static_cast<int32_t>(portHandle);
+void AAudioServiceEndpointMMAP::onRoutingChanged(const android::DeviceIdVector& deviceIds) {
+ const auto deviceId = android::getFirstDeviceId(deviceIds);
+ // TODO(b/367816690): Compare the new and saved device sets.
ALOGD("%s() called with dev %d, old = %d", __func__, deviceId, getDeviceId());
if (getDeviceId() != deviceId) {
if (getDeviceId() != AUDIO_PORT_HANDLE_NONE) {