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

Commit c60828e2 authored by Kiran Kumar Krishna's avatar Kiran Kumar Krishna Committed by Glenn Kasten
Browse files

AudioRecord: fix AudioRecordThread crash upon exit

In case of error during openRecord_l(), there is a possibility
that a newly created AudioRecordThread is resumed by requestExit()
just after entering the Thread class _threadLoop() but before
entering the class threadLoop(). In this case, processAudioBuffer()
is executed once with mCblk == 0 and we assert.

Test: test case at bug
Bug: 29993798
Change-Id: I15d4f138218f6f01a020c4fc568a5b4831cb92a7
parent 97bcb4f3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1274,6 +1274,9 @@ bool AudioRecord::AudioRecordThread::threadLoop()
            return true;
        }
    }
    if (exitPending()) {
        return false;
    }
    nsecs_t ns =  mReceiver.processAudioBuffer();
    switch (ns) {
    case 0: