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

Commit 555e6b88 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "libaudiohal: only call getAudioPort if it is supported." into main

parents 18a8ffa0 19a3d726
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -752,11 +752,15 @@ status_t DeviceHalHidl::getAudioMixPort(const struct audio_port_v7 *devicePort,
    // the attributes reported by `getParameters` API.
    struct audio_port_v7 temp = *devicePort;
    AudioProfileAttributesMultimap attrsFromDevice;
    status_t status = getAudioPort(&temp);
    if (status == NO_ERROR) {
    bool supportsPatches;
    if (supportsAudioPatches(&supportsPatches) == OK && supportsPatches) {
        // The audio patches are supported since HAL 3.0, which is the same HAL version
        // requirement for 'getAudioPort' API.
        if (getAudioPort(&temp) == NO_ERROR) {
            attrsFromDevice = createAudioProfilesAttrMap(temp.audio_profiles, 0 /*first*/,
                                                         temp.num_audio_profiles);
        }
    }
    auto streamIt = mStreams.find(mixPort->ext.mix.handle);
    if (streamIt == mStreams.end()) {
        return BAD_VALUE;
@@ -767,7 +771,7 @@ status_t DeviceHalHidl::getAudioMixPort(const struct audio_port_v7 *devicePort,
    }

    String8 formatsStr;
    status = getParametersFromStream(
    status_t status = getParametersFromStream(
            stream, AudioParameter::keyStreamSupportedFormats, nullptr /*extraParameters*/,
            &formatsStr);
    if (status != NO_ERROR) {