AudioFlinger: provide downstream sink device to software patch source
When opening an input stream for a software patch, pass in
the downstream destination device info. This helps the intermediate
module to set up any device-specific processing.
Note that the intermediate module must implement Audio HAL V5.0
in order to be able to receive this information. It's not available
on the legacy audio HAL API either.
Bug: 120859615
Test: make
Change-Id: I542a47d2c299fe19f576d5f5c2b237cc00ae5b93
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 26f76c0..0d6ef46 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -2379,7 +2379,8 @@
return BAD_VALUE;
}
- sp<ThreadBase> thread = openInput_l(module, input, config, *devices, address, source, flags);
+ sp<ThreadBase> thread = openInput_l(
+ module, input, config, *devices, address, source, flags, AUDIO_DEVICE_NONE, String8{});
if (thread != 0) {
// notify client processes of the new input creation
@@ -2395,7 +2396,9 @@
audio_devices_t devices,
const String8& address,
audio_source_t source,
- audio_input_flags_t flags)
+ audio_input_flags_t flags,
+ audio_devices_t outputDevice,
+ const String8& outputDeviceAddress)
{
AudioHwDevice *inHwDev = findSuitableHwDev_l(module, devices);
if (inHwDev == NULL) {
@@ -2424,7 +2427,8 @@
sp<DeviceHalInterface> inHwHal = inHwDev->hwDevice();
sp<StreamInHalInterface> inStream;
status_t status = inHwHal->openInputStream(
- *input, devices, &halconfig, flags, address.string(), source, &inStream);
+ *input, devices, &halconfig, flags, address.string(), source,
+ outputDevice, outputDeviceAddress, &inStream);
ALOGV("openInput_l() openInputStream returned input %p, devices %#x, SamplingRate %d"
", Format %#x, Channels %#x, flags %#x, status %d addr %s",
inStream.get(),
@@ -2447,7 +2451,8 @@
ALOGV("openInput_l() reopening with proposed sampling rate and channel mask");
inStream.clear();
status = inHwHal->openInputStream(
- *input, devices, &halconfig, flags, address.string(), source, &inStream);
+ *input, devices, &halconfig, flags, address.string(), source,
+ outputDevice, outputDeviceAddress, &inStream);
// FIXME log this new status; HAL should not propose any further changes
}