diff options
author | Glenn Kasten <gkasten@google.com> | 2013-09-20 14:06:35 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-09-20 14:06:35 -0700 |
commit | dd0a81253bcf4daef56e991c94dc3c0d1124ef90 (patch) | |
tree | 78964e9809df16c448d0fadf5f3b654845b1d901 /include | |
parent | b0a5e24d162f6ff55aca720c3562556b87d69637 (diff) | |
parent | f2c643c89e405b57c7ce42067b876fb80031e5fa (diff) | |
download | frameworks_av-dd0a81253bcf4daef56e991c94dc3c0d1124ef90.zip frameworks_av-dd0a81253bcf4daef56e991c94dc3c0d1124ef90.tar.gz frameworks_av-dd0a81253bcf4daef56e991c94dc3c0d1124ef90.tar.bz2 |
am f2c643c8: am 3b3cfcfa: Merge "Fix slow AudioTrack and AudioRecord destruction" into klp-dev
* commit 'f2c643c89e405b57c7ce42067b876fb80031e5fa':
Fix slow AudioTrack and AudioRecord destruction
Diffstat (limited to 'include')
-rw-r--r-- | include/media/AudioRecord.h | 10 | ||||
-rw-r--r-- | include/media/AudioTrack.h | 10 |
2 files changed, 12 insertions, 8 deletions
diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h index 36430a3..fb47448 100644 --- a/include/media/AudioRecord.h +++ b/include/media/AudioRecord.h @@ -398,18 +398,20 @@ private: void pause(); // suspend thread from execution at next loop boundary void resume(); // allow thread to execute, if not requested to exit - void pauseConditional(); - // like pause(), but only if prior resume() wasn't latched private: + void pauseInternal(nsecs_t ns = 0LL); + // like pause(), but only used internally within thread + friend class AudioRecord; virtual bool threadLoop(); AudioRecord& mReceiver; virtual ~AudioRecordThread(); Mutex mMyLock; // Thread::mLock is private Condition mMyCond; // Thread::mThreadExitedCondition is private - bool mPaused; // whether thread is currently paused - bool mResumeLatch; // whether next pauseConditional() will be a nop + bool mPaused; // whether thread is requested to pause at next loop entry + bool mPausedInt; // whether thread internally requests pause + nsecs_t mPausedNs; // if mPausedInt then associated timeout, otherwise ignored }; // body of AudioRecordThread::threadLoop() diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h index 56bf49a..f863e35 100644 --- a/include/media/AudioTrack.h +++ b/include/media/AudioTrack.h @@ -598,18 +598,20 @@ protected: void pause(); // suspend thread from execution at next loop boundary void resume(); // allow thread to execute, if not requested to exit - void pauseConditional(); - // like pause(), but only if prior resume() wasn't latched private: + void pauseInternal(nsecs_t ns = 0LL); + // like pause(), but only used internally within thread + friend class AudioTrack; virtual bool threadLoop(); AudioTrack& mReceiver; virtual ~AudioTrackThread(); Mutex mMyLock; // Thread::mLock is private Condition mMyCond; // Thread::mThreadExitedCondition is private - bool mPaused; // whether thread is currently paused - bool mResumeLatch; // whether next pauseConditional() will be a nop + bool mPaused; // whether thread is requested to pause at next loop entry + bool mPausedInt; // whether thread internally requests pause + nsecs_t mPausedNs; // if mPausedInt then associated timeout, otherwise ignored }; // body of AudioTrackThread::threadLoop() |