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

Commit 44aa568c authored by Jasmine Cha's avatar Jasmine Cha Committed by Automerger Merge Worker
Browse files

audio policy: fix disordered sequence while changing device am: 7f82d1a7 am:...

audio policy: fix disordered sequence while changing device am: 7f82d1a7 am: 8d386f77 am: beaff774

Change-Id: I94ce9fe038819da0991dd7689a31f73b90bb9b66
parents b0631eff beaff774
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -5710,7 +5710,10 @@ uint32_t AudioPolicyManager::setOutputDevices(const sp<SwAudioOutputDescriptor>&
            patchBuilder.addSink(filteredDevice);
        }

        installPatch(__func__, patchHandle, outputDesc.get(), patchBuilder.patch(), delayMs);
        // Add half reported latency to delayMs when muteWaitMs is null in order
        // to avoid disordered sequence of muting volume and changing devices.
        installPatch(__func__, patchHandle, outputDesc.get(), patchBuilder.patch(),
                muteWaitMs == 0 ? (delayMs + (outputDesc->latency() / 2)) : delayMs);
    }

    // update stream volumes according to new device