diff options
author | Glenn Kasten <gkasten@google.com> | 2012-11-02 13:05:14 -0700 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2012-11-07 16:11:56 -0800 |
commit | a96bd95dcfe886436652debbda77ceb634729da0 (patch) | |
tree | 293bcff0960a789cc5b437a458c65795bd8b4c14 /include | |
parent | 891b11da870ad3f860c1d2610ef4d8836ed6c590 (diff) | |
download | frameworks_av-a96bd95dcfe886436652debbda77ceb634729da0.zip frameworks_av-a96bd95dcfe886436652debbda77ceb634729da0.tar.gz frameworks_av-a96bd95dcfe886436652debbda77ceb634729da0.tar.bz2 |
Fix call to restoreTrack_l() without lock held
Also document lock order
Change-Id: I2c1f273a0a51fa79ee3dd766de8d23083e270051
Diffstat (limited to 'include')
-rw-r--r-- | include/media/AudioTrack.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h index 529f74e..1a19999 100644 --- a/include/media/AudioTrack.h +++ b/include/media/AudioTrack.h @@ -481,6 +481,7 @@ protected: // body of AudioTrackThread::threadLoop() bool processAudioBuffer(const sp<AudioTrackThread>& thread); + // caller must hold lock on mLock for all _l methods status_t createTrack_l(audio_stream_type_t streamType, uint32_t sampleRate, audio_format_t format, @@ -535,7 +536,13 @@ protected: audio_output_flags_t mFlags; int mSessionId; int mAuxEffectId; + + // When locking both mLock and mCblk->lock, must lock in this order to avoid deadlock: + // 1. mLock + // 2. mCblk->lock + // It is OK to lock only mCblk->lock. mutable Mutex mLock; + status_t mRestoreStatus; bool mIsTimed; int mPreviousPriority; // before start() |