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

Commit fca9868c authored by Andy Hung's avatar Andy Hung Committed by Android Git Automerger
Browse files

am 63310b10: Merge "Fix race condition in AudioRecordThread::wake" into mnc-dev

* commit '63310b10':
  Fix race condition in AudioRecordThread::wake
parents 9a89ceeb 63310b10
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -1235,13 +1235,17 @@ void AudioRecord::AudioRecordThread::resume()
void AudioRecord::AudioRecordThread::wake()
void AudioRecord::AudioRecordThread::wake()
{
{
    AutoMutex _l(mMyLock);
    AutoMutex _l(mMyLock);
    if (!mPaused && mPausedInt && mPausedNs > 0) {
    if (!mPaused) {
        // audio record is active and internally paused with timeout.
        // wake() might be called while servicing a callback - ignore the next
        // pause time and call processAudioBuffer.
        mIgnoreNextPausedInt = true;
        mIgnoreNextPausedInt = true;
        if (mPausedInt && mPausedNs > 0) {
            // audio record is active and internally paused with timeout.
            mPausedInt = false;
            mPausedInt = false;
            mMyCond.signal();
            mMyCond.signal();
        }
        }
    }
    }
}


void AudioRecord::AudioRecordThread::pauseInternal(nsecs_t ns)
void AudioRecord::AudioRecordThread::pauseInternal(nsecs_t ns)
{
{