Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4e037e0 authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

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
parent 8292a716
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -268,6 +268,8 @@ status_t DeviceHalHidl::openInputStream(
        audio_input_flags_t flags,
        const char *address,
        audio_source_t source,
        audio_devices_t outputDevice,
        const char *outputDeviceAddress,
        sp<StreamInHalInterface> *inStream) {
    if (mDevice == 0) return NO_INIT;
    DeviceAddress hidlDevice;
@@ -282,6 +284,17 @@ status_t DeviceHalHidl::openInputStream(
    // TODO: correctly propagate the tracks sources and volume
    //       for now, only send the main source at 1dbfs
    SinkMetadata sinkMetadata = {{{ .source = AudioSource(source), .gain = 1 }}};
#endif
#if MAJOR_VERSION < 5
    (void)outputDevice;
    (void)outputDeviceAddress;
#else
    if (outputDevice != AUDIO_DEVICE_NONE) {
        DeviceAddress hidlOutputDevice;
        status = deviceAddressFromHal(outputDevice, outputDeviceAddress, &hidlOutputDevice);
        if (status != OK) return status;
        sinkMetadata.tracks[0].destination.device(std::move(hidlOutputDevice));
    }
#endif
    Return<void> ret = mDevice->openInputStream(
            handle,
+2 −0
Original line number Diff line number Diff line
@@ -86,6 +86,8 @@ class DeviceHalHidl : public DeviceHalInterface, public ConversionHelperHidl
            audio_input_flags_t flags,
            const char *address,
            audio_source_t source,
            audio_devices_t outputDevice,
            const char *outputDeviceAddress,
            sp<StreamInHalInterface> *inStream);

    // Returns whether createAudioPatch and releaseAudioPatch operations are supported.
+2 −0
Original line number Diff line number Diff line
@@ -131,6 +131,8 @@ status_t DeviceHalLocal::openInputStream(
        audio_input_flags_t flags,
        const char *address,
        audio_source_t source,
        audio_devices_t /*outputDevice*/,
        const char */*outputDeviceAddress*/,
        sp<StreamInHalInterface> *inStream) {
    audio_stream_in_t *halStream;
    ALOGV("open_input_stream handle: %d devices: %x flags: %#x "
+2 −0
Original line number Diff line number Diff line
@@ -79,6 +79,8 @@ class DeviceHalLocal : public DeviceHalInterface
            audio_input_flags_t flags,
            const char *address,
            audio_source_t source,
            audio_devices_t outputDevice,
            const char *outputDeviceAddress,
            sp<StreamInHalInterface> *inStream);

    // Returns whether createAudioPatch and releaseAudioPatch operations are supported.
+2 −0
Original line number Diff line number Diff line
@@ -84,6 +84,8 @@ class DeviceHalInterface : public RefBase
            audio_input_flags_t flags,
            const char *address,
            audio_source_t source,
            audio_devices_t outputDevice,
            const char *outputDeviceAddress,
            sp<StreamInHalInterface> *inStream) = 0;

    // Returns whether createAudioPatch and releaseAudioPatch operations are supported.
Loading