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

Commit e260f5a3 authored by Atneya Nair's avatar Atneya Nair
Browse files

Properly unlock on return in process thread

There is a return path in processAudioBuffer that did not
properly drop AudioTrack/AudioRecord object locks, leading
to deadlocks, which were only triggered upon certain lifetime
races.

Test: atest AudioTrackTest, atest AudioRecordTest
Bug: 230312538
Change-Id: I1d48061eca67ef7d5908ae8bd5186cbb3598f149
parent 688cec6e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1331,6 +1331,7 @@ nsecs_t AudioRecord::processAudioBuffer()
    const sp<IAudioRecordCallback> callback = mCallback.promote();
    if (!callback) {
        mCallback = nullptr;
        mLock.unlock();
        return NS_NEVER;
    }
    if (mAwaitBoost) {
+1 −0
Original line number Diff line number Diff line
@@ -2448,6 +2448,7 @@ nsecs_t AudioTrack::processAudioBuffer()
    sp<IAudioTrackCallback> callback = mCallback.promote();
    if (!callback) {
        mCallback = nullptr;
        mLock.unlock();
        return NS_NEVER;
    }
    if (mAwaitBoost) {