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

Commit b141c526 authored by François Gaffie's avatar François Gaffie Committed by Eric Laurent
Browse files

audiopolicy: apm: Fix segfault when using bus device without Policy Mix



Test: manual audio smoke tests
Change-Id: Ic9ecd5928931d63d42cecea7283c7282ec43ebc0
Signed-off-by: default avatarFrançois Gaffie <francois.gaffie@renault.com>
parent 716e1435
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -4271,12 +4271,13 @@ status_t AudioPolicyManager::checkOutputsForDevice(const sp<DeviceDescriptor>& d
                    addOutput(output, desc);
                    if (device_distinguishes_on_address(deviceType) && address != "0") {
                        sp<AudioPolicyMix> policyMix;
                        if (mPolicyMixes.getAudioPolicyMix(address, policyMix) != NO_ERROR) {
                            ALOGE("checkOutputsForDevice() cannot find policy for address %s",
                                  address.string());
                        }
                        if (mPolicyMixes.getAudioPolicyMix(address, policyMix) == NO_ERROR) {
                            policyMix->setOutput(desc);
                            desc->mPolicyMix = policyMix->getMix();
                        } else {
                            ALOGW("checkOutputsForDevice() cannot find policy for address %s",
                                  address.string());
                        }

                    } else if (((desc->mFlags & AUDIO_OUTPUT_FLAG_DIRECT) == 0) &&
                                    hasPrimaryOutput()) {