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

Commit ccc1963e authored by Eric Laurent's avatar Eric Laurent Committed by Android Build Cherrypicker Worker
Browse files

audio policy: clean up initial spatializer audio patch

During audio policy initialization, a spatializer stream is opened and
then closed but the audio patch cleanup normally done in closeOutput()
was omitted causing a stale audio patch to remain in audio flinger and
audio HAL.

Bug: 333829626
Test: repro steps in bug
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a70bc37c1c5000ee161d84cf345fecedb7007baa)
Merged-In: I525c1c2fc91d6fc70bfd602c699562658e9bb7a1
Change-Id: I525c1c2fc91d6fc70bfd602c699562658e9bb7a1
parent c0a1ab76
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -6397,6 +6397,15 @@ void AudioPolicyManager::onNewAudioModulesAvailableInt(DeviceVector *newDevices)
        if ((desc->mFlags & AUDIO_OUTPUT_FLAG_SPATIALIZER) != 0
                && !isOutputOnlyAvailableRouteToSomeDevice(desc)) {
            outputsClosed.push_back(desc->mIoHandle);
            nextAudioPortGeneration();
            ssize_t index = mAudioPatches.indexOfKey(desc->getPatchHandle());
            if (index >= 0) {
                sp<AudioPatch> patchDesc = mAudioPatches.valueAt(index);
                (void) /*status_t status*/ mpClientInterface->releaseAudioPatch(
                            patchDesc->getAfHandle(), 0);
                mAudioPatches.removeItemsAt(index);
                mpClientInterface->onAudioPatchListUpdate();
            }
            desc->close();
        }
    }