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

Commit c88b0644 authored by Andy Hung's avatar Andy Hung
Browse files

Fix getOutputForAttr to avoid binder parameter in/out change

Bug: 78796725
Test: test_interference.cpp
Change-Id: Iab9f337d750910c896839c8905c945a181a133c7
parent ed4f0147
Loading
Loading
Loading
Loading
+16 −19
Original line number Diff line number Diff line
@@ -812,7 +812,7 @@ status_t AudioPolicyManager::getOutputForAttr(const audio_attributes_t *attr,
          "flags %#x",
          device, config->sample_rate, config->format, config->channel_mask, *flags);

    *output = getOutputForDevice(device, session, *stream, *output, config, flags);
    *output = getOutputForDevice(device, session, *stream, config, flags);
    if (*output == AUDIO_IO_HANDLE_NONE) {
        mOutputRoutes.removeRoute(session);
        return INVALID_OPERATION;
@@ -831,11 +831,10 @@ audio_io_handle_t AudioPolicyManager::getOutputForDevice(
        audio_devices_t device,
        audio_session_t session,
        audio_stream_type_t stream,
        audio_io_handle_t originalOutput,
        const audio_config_t *config,
        audio_output_flags_t *flags)
{
    audio_io_handle_t output = originalOutput;
    audio_io_handle_t output = AUDIO_IO_HANDLE_NONE;
    status_t status;

    // open a direct output if required by specified parameters
@@ -899,8 +898,7 @@ audio_io_handle_t AudioPolicyManager::getOutputForDevice(
    }

    if (profile != 0) {
        // exclude MMAP streams
        if ((*flags & AUDIO_OUTPUT_FLAG_MMAP_NOIRQ) == 0 || output != AUDIO_IO_HANDLE_NONE) {
        // exclusive outputs for MMAP and Offload are enforced by different session ids.
        for (size_t i = 0; i < mOutputs.size(); i++) {
            sp<SwAudioOutputDescriptor> desc = mOutputs.valueAt(i);
            if (!desc->isDuplicated() && (profile == desc->mProfile)) {
@@ -917,7 +915,6 @@ audio_io_handle_t AudioPolicyManager::getOutputForDevice(
                }
            }
        }
        }

        if (!profile->canOpenNewIo()) {
            goto non_direct_output;
+0 −1
Original line number Diff line number Diff line
@@ -628,7 +628,6 @@ private:
                audio_devices_t device,
                audio_session_t session,
                audio_stream_type_t stream,
                audio_io_handle_t originalOutput,
                const audio_config_t *config,
                audio_output_flags_t *flags);
        // internal method to return the input handle for the given device and format