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

Commit 425180d0 authored by Weiyin Jiang's avatar Weiyin Jiang Committed by Gerrit - the friendly Code Review server
Browse files

audio: follow routine lock order to avoid deadlock

Inconsistent locking order leads to potential deadlock, follow the
sequence that adev lock to be acquired after stream lock to resolve
such scenario.

CRs-Fixed: 2056285
Change-Id: If7d9384dcf862e5a504df4ad55c8fa8ce7d8a113
parent b4288b8e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -4663,7 +4663,10 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
            if ((usecase->type == PCM_PLAYBACK) &&
                (usecase->devices & AUDIO_DEVICE_OUT_ALL_A2DP)){
                ALOGD("reconfigure a2dp... forcing device switch");

                pthread_mutex_unlock(&adev->lock);
                lock_output_stream(usecase->stream.out);
                pthread_mutex_lock(&adev->lock);
                audio_extn_a2dp_set_handoff_mode(true);
                //force device switch to re configure encoder
                select_devices(adev, usecase->id);