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

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

am 9f00e69c: Merge "Fix race condition in AudioTrackThread::wake" into mnc-dev

* commit '9f00e69c':
  Fix race condition in AudioTrackThread::wake
parents fca9868c 9f00e69c
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -2551,13 +2551,17 @@ void AudioTrack::AudioTrackThread::resume()
void AudioTrack::AudioTrackThread::wake()
void AudioTrack::AudioTrackThread::wake()
{
{
    AutoMutex _l(mMyLock);
    AutoMutex _l(mMyLock);
    if (!mPaused && mPausedInt && mPausedNs > 0) {
    if (!mPaused) {
        // audio track 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 track is active and internally paused with timeout.
            mPausedInt = false;
            mPausedInt = false;
            mMyCond.signal();
            mMyCond.signal();
        }
        }
    }
    }
}


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