diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-07-31 08:55:51 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-07-31 08:55:51 -0700 |
commit | 1b0efec3473134fb7de226f3e1fdade5b3529ad9 (patch) | |
tree | 8f3c4a9988820183ee63aa85dcb2e7c0608eb7f7 /media | |
parent | 010582885cbd5e1becadd6c53816c399465b459d (diff) | |
parent | 17c195c8da3470b2e69880e206342f0c2d85f938 (diff) | |
download | frameworks_base-1b0efec3473134fb7de226f3e1fdade5b3529ad9.zip frameworks_base-1b0efec3473134fb7de226f3e1fdade5b3529ad9.tar.gz frameworks_base-1b0efec3473134fb7de226f3e1fdade5b3529ad9.tar.bz2 |
am 17c195c8: Merge change 9340 into donut
Merge commit '17c195c8da3470b2e69880e206342f0c2d85f938'
* commit '17c195c8da3470b2e69880e206342f0c2d85f938':
Fix issue 2025872: Deadlock in SoundPool.stop
Diffstat (limited to 'media')
-rw-r--r-- | media/jni/soundpool/SoundPool.cpp | 19 | ||||
-rw-r--r-- | media/jni/soundpool/SoundPool.h | 1 |
2 files changed, 9 insertions, 11 deletions
diff --git a/media/jni/soundpool/SoundPool.cpp b/media/jni/soundpool/SoundPool.cpp index 0d07abe..b17e31b 100644 --- a/media/jni/soundpool/SoundPool.cpp +++ b/media/jni/soundpool/SoundPool.cpp @@ -93,7 +93,7 @@ SoundPool::~SoundPool() void SoundPool::addToRestartList(SoundChannel* channel) { - Mutex::Autolock lock(&mLock); + Mutex::Autolock lock(&mRestartLock); mRestart.push_back(channel); mCondition.signal(); } @@ -106,9 +106,9 @@ int SoundPool::beginThread(void* arg) int SoundPool::run() { - mLock.lock(); + mRestartLock.lock(); while (!mQuit) { - mCondition.wait(mLock); + mCondition.wait(mRestartLock); LOGV("awake"); if (mQuit) break; @@ -125,19 +125,19 @@ int SoundPool::run() mRestart.clear(); mCondition.signal(); - mLock.unlock(); + mRestartLock.unlock(); LOGV("goodbye"); return 0; } void SoundPool::quit() { - mLock.lock(); + mRestartLock.lock(); mQuit = true; mCondition.signal(); - mCondition.wait(mLock); + mCondition.wait(mRestartLock); LOGV("return from quit"); - mLock.unlock(); + mRestartLock.unlock(); } bool SoundPool::startThreads() @@ -484,11 +484,8 @@ void SoundChannel::play(const sp<Sample>& sample, int nextChannelID, float leftV // if not idle, this voice is being stolen if (mState != IDLE) { LOGV("channel %d stolen - event queued for channel %d", channelID(), nextChannelID); - stop_l(); mNextEvent.set(sample, nextChannelID, leftVolume, rightVolume, priority, loop, rate); -#ifdef USE_SHARED_MEM_BUFFER - mSoundPool->done(this); -#endif + stop(); return; } diff --git a/media/jni/soundpool/SoundPool.h b/media/jni/soundpool/SoundPool.h index 7802781..ab86e90 100644 --- a/media/jni/soundpool/SoundPool.h +++ b/media/jni/soundpool/SoundPool.h @@ -204,6 +204,7 @@ private: jobject mSoundPoolRef; Mutex mLock; + Mutex mRestartLock; Condition mCondition; SoundPoolThread* mDecodeThread; SoundChannel* mChannelPool; |