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

Commit 9b6cd785 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "audio policy: always provide a valid device address when opening a stream" into oc-dev

parents 441f2ccb e301410b
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -1007,11 +1007,14 @@ audio_io_handle_t AudioPolicyManager::getOutputForDevice(
        if (offloadInfo != NULL) {
            config.offload_info = *offloadInfo;
        }
        DeviceVector outputDevices = mAvailableOutputDevices.getDevicesFromType(device);
        String8 address = outputDevices.size() > 0 ? outputDevices.itemAt(0)->mAddress
                : String8("");
        status = mpClientInterface->openOutput(profile->getModuleHandle(),
                                               &output,
                                               &config,
                                               &outputDesc->mDevice,
                                               String8(""),
                                               address,
                                               &outputDesc->mLatency,
                                               outputDesc->mFlags);

@@ -1699,6 +1702,12 @@ audio_io_handle_t AudioPolicyManager::getInputForDevice(audio_devices_t device,
    config.channel_mask = profileChannelMask;
    config.format = profileFormat;

    if (address == "") {
        DeviceVector inputDevices = mAvailableInputDevices.getDevicesFromType(device);
        //   the inputs vector must be of size 1, but we don't want to crash here
        address = inputDevices.size() > 0 ? inputDevices.itemAt(0)->mAddress : String8("");
    }

    status_t status = mpClientInterface->openInput(profile->getModuleHandle(),
                                                   &input,
                                                   &config,