Loading include/media/AudioTrack.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -612,6 +612,7 @@ protected: bool mPaused; // whether thread is requested to pause at next loop entry bool mPaused; // whether thread is requested to pause at next loop entry bool mPausedInt; // whether thread internally requests pause bool mPausedInt; // whether thread internally requests pause nsecs_t mPausedNs; // if mPausedInt then associated timeout, otherwise ignored nsecs_t mPausedNs; // if mPausedInt then associated timeout, otherwise ignored bool mIgnoreNextPausedInt; // whether to ignore next mPausedInt request }; }; // body of AudioTrackThread::threadLoop() // body of AudioTrackThread::threadLoop() Loading media/libmedia/AudioTrack.cpp +8 −7 Original line number Original line Diff line number Diff line Loading @@ -1787,7 +1787,8 @@ void AudioTrack::DeathNotifier::binderDied(const wp<IBinder>& who) // ========================================================================= // ========================================================================= AudioTrack::AudioTrackThread::AudioTrackThread(AudioTrack& receiver, bool bCanCallJava) AudioTrack::AudioTrackThread::AudioTrackThread(AudioTrack& receiver, bool bCanCallJava) : Thread(bCanCallJava), mReceiver(receiver), mPaused(true), mPausedInt(false), mPausedNs(0LL) : Thread(bCanCallJava), mReceiver(receiver), mPaused(true), mPausedInt(false), mPausedNs(0LL), mIgnoreNextPausedInt(false) { { } } Loading @@ -1804,6 +1805,10 @@ bool AudioTrack::AudioTrackThread::threadLoop() // caller will check for exitPending() // caller will check for exitPending() return true; return true; } } if (mIgnoreNextPausedInt) { mIgnoreNextPausedInt = false; mPausedInt = false; } if (mPausedInt) { if (mPausedInt) { if (mPausedNs > 0) { if (mPausedNs > 0) { (void) mMyCond.waitRelative(mMyLock, mPausedNs); (void) mMyCond.waitRelative(mMyLock, mPausedNs); Loading Loading @@ -1838,12 +1843,7 @@ void AudioTrack::AudioTrackThread::requestExit() { { // must be in this order to avoid a race condition // must be in this order to avoid a race condition Thread::requestExit(); Thread::requestExit(); AutoMutex _l(mMyLock); resume(); if (mPaused || mPausedInt) { mPaused = false; mPausedInt = false; mMyCond.signal(); } } } void AudioTrack::AudioTrackThread::pause() void AudioTrack::AudioTrackThread::pause() Loading @@ -1855,6 +1855,7 @@ void AudioTrack::AudioTrackThread::pause() void AudioTrack::AudioTrackThread::resume() void AudioTrack::AudioTrackThread::resume() { { AutoMutex _l(mMyLock); AutoMutex _l(mMyLock); mIgnoreNextPausedInt = true; if (mPaused || mPausedInt) { if (mPaused || mPausedInt) { mPaused = false; mPaused = false; mPausedInt = false; mPausedInt = false; Loading Loading
include/media/AudioTrack.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -612,6 +612,7 @@ protected: bool mPaused; // whether thread is requested to pause at next loop entry bool mPaused; // whether thread is requested to pause at next loop entry bool mPausedInt; // whether thread internally requests pause bool mPausedInt; // whether thread internally requests pause nsecs_t mPausedNs; // if mPausedInt then associated timeout, otherwise ignored nsecs_t mPausedNs; // if mPausedInt then associated timeout, otherwise ignored bool mIgnoreNextPausedInt; // whether to ignore next mPausedInt request }; }; // body of AudioTrackThread::threadLoop() // body of AudioTrackThread::threadLoop() Loading
media/libmedia/AudioTrack.cpp +8 −7 Original line number Original line Diff line number Diff line Loading @@ -1787,7 +1787,8 @@ void AudioTrack::DeathNotifier::binderDied(const wp<IBinder>& who) // ========================================================================= // ========================================================================= AudioTrack::AudioTrackThread::AudioTrackThread(AudioTrack& receiver, bool bCanCallJava) AudioTrack::AudioTrackThread::AudioTrackThread(AudioTrack& receiver, bool bCanCallJava) : Thread(bCanCallJava), mReceiver(receiver), mPaused(true), mPausedInt(false), mPausedNs(0LL) : Thread(bCanCallJava), mReceiver(receiver), mPaused(true), mPausedInt(false), mPausedNs(0LL), mIgnoreNextPausedInt(false) { { } } Loading @@ -1804,6 +1805,10 @@ bool AudioTrack::AudioTrackThread::threadLoop() // caller will check for exitPending() // caller will check for exitPending() return true; return true; } } if (mIgnoreNextPausedInt) { mIgnoreNextPausedInt = false; mPausedInt = false; } if (mPausedInt) { if (mPausedInt) { if (mPausedNs > 0) { if (mPausedNs > 0) { (void) mMyCond.waitRelative(mMyLock, mPausedNs); (void) mMyCond.waitRelative(mMyLock, mPausedNs); Loading Loading @@ -1838,12 +1843,7 @@ void AudioTrack::AudioTrackThread::requestExit() { { // must be in this order to avoid a race condition // must be in this order to avoid a race condition Thread::requestExit(); Thread::requestExit(); AutoMutex _l(mMyLock); resume(); if (mPaused || mPausedInt) { mPaused = false; mPausedInt = false; mMyCond.signal(); } } } void AudioTrack::AudioTrackThread::pause() void AudioTrack::AudioTrackThread::pause() Loading @@ -1855,6 +1855,7 @@ void AudioTrack::AudioTrackThread::pause() void AudioTrack::AudioTrackThread::resume() void AudioTrack::AudioTrackThread::resume() { { AutoMutex _l(mMyLock); AutoMutex _l(mMyLock); mIgnoreNextPausedInt = true; if (mPaused || mPausedInt) { if (mPaused || mPausedInt) { mPaused = false; mPaused = false; mPausedInt = false; mPausedInt = false; Loading