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

Commit 8e544543 authored by Francois Gaffie's avatar Francois Gaffie Committed by Eric Laurent
Browse files

AudioPolicy: manager: fix patch list growing up



commit 3b17354a caused potential stale audio patches
records in audio policy manager for patches associated
with audio flinger software patches sharing an output mixer.

Bug: 136121584
Test: dumpsys media.audio_policy &&
adb shell /data/nativetest64/AudioPolicyEmulatorTests/AudioPolicyEmulatorTests --gtest_filter=AudioPatchTest/AudioModeBridgingTest.
&& dumpsys media.audio_policy:
ensure list of patches did not grow up
Test: atest audiopolicy_tests

Signed-off-by: default avatarFrancois Gaffie <francois.gaffie@renault.com>
Change-Id: Ife8035dc2d2d9c0b568d6847ca5eb0d2cba77cea
parent e0c3d791
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -3820,7 +3820,11 @@ status_t AudioPolicyManager::releaseAudioPatchInternal(audio_patch_handle_t hand
                    ALOGE("%s output not found for id %d", __func__, patch->sources[0].id);
                    return BAD_VALUE;
                }
                // Reset handle so that setOutputDevice will force new AF patch to reach the sink
                if (patchDesc->getHandle() != outputDesc->getPatchHandle()) {
                    // force SwOutput patch removal as AF counter part patch has already gone.
                    ALOGV("%s reset patch handle on Output as different from SWBridge", __func__);
                    removeAudioPatch(outputDesc->getPatchHandle());
                }
                outputDesc->setPatchHandle(AUDIO_PATCH_HANDLE_NONE);
                setOutputDevices(outputDesc,
                                 getNewOutputDevices(outputDesc, true /*fromCache*/),