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

Commit a8d0890c authored by Andy Hung's avatar Andy Hung
Browse files

Fix race condition in AudioTrackThread::wake

Bug: 22533684
Change-Id: I2f46770dca44fc9dae41e067d3bec893c42a826e
parent 805a0c70
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -2551,13 +2551,17 @@ void AudioTrack::AudioTrackThread::resume()
void AudioTrack::AudioTrackThread::wake()
{
    AutoMutex _l(mMyLock);
    if (!mPaused && mPausedInt && mPausedNs > 0) {
        // audio track is active and internally paused with timeout.
    if (!mPaused) {
        // wake() might be called while servicing a callback - ignore the next
        // pause time and call processAudioBuffer.
        mIgnoreNextPausedInt = true;
        if (mPausedInt && mPausedNs > 0) {
            // audio track is active and internally paused with timeout.
            mPausedInt = false;
            mMyCond.signal();
        }
    }
}

void AudioTrack::AudioTrackThread::pauseInternal(nsecs_t ns)
{