diff options
author | Andreas Huber <andih@google.com> | 2011-09-01 11:39:11 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2011-09-01 11:39:11 -0700 |
commit | 02f6e988107bc13ebe4828b734ea0fc3d9d11ae0 (patch) | |
tree | 33ae71e49d527dba2905559879002be3d48a580b /media/libstagefright/AwesomePlayer.cpp | |
parent | a8e409f8f9b40737d0b03355894b5e141d0aff6b (diff) | |
download | frameworks_av-02f6e988107bc13ebe4828b734ea0fc3d9d11ae0.zip frameworks_av-02f6e988107bc13ebe4828b734ea0fc3d9d11ae0.tar.gz frameworks_av-02f6e988107bc13ebe4828b734ea0fc3d9d11ae0.tar.bz2 |
Guard the audio notifications with a separate lock to avoid deadlocks during reset.
Change-Id: I9a97372e1f777d1cbd6774cac2ed34b4b8cd9392
related-to-bug: 5179827
Diffstat (limited to 'media/libstagefright/AwesomePlayer.cpp')
-rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index f98b0de..47224cc 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -978,7 +978,7 @@ status_t AwesomePlayer::startAudioPlayer_l(bool sendErrorNotification) { CHECK(!mAudioPlayer->isSeeking()); // We will have finished the seek while starting the audio player. - postAudioSeekComplete_l(); + postAudioSeekComplete(); } } else { mAudioPlayer->resume(); @@ -1877,7 +1877,8 @@ void AwesomePlayer::postVideoLagEvent_l() { mQueue.postEventWithDelay(mVideoLagEvent, 1000000ll); } -void AwesomePlayer::postCheckAudioStatusEvent_l(int64_t delayUs) { +void AwesomePlayer::postCheckAudioStatusEvent(int64_t delayUs) { + Mutex::Autolock autoLock(mAudioLock); if (mAudioStatusEventPending) { return; } @@ -1886,14 +1887,18 @@ void AwesomePlayer::postCheckAudioStatusEvent_l(int64_t delayUs) { } void AwesomePlayer::onCheckAudioStatus() { - Mutex::Autolock autoLock(mLock); - if (!mAudioStatusEventPending) { - // Event was dispatched and while we were blocking on the mutex, - // has already been cancelled. - return; + { + Mutex::Autolock autoLock(mAudioLock); + if (!mAudioStatusEventPending) { + // Event was dispatched and while we were blocking on the mutex, + // has already been cancelled. + return; + } + + mAudioStatusEventPending = false; } - mAudioStatusEventPending = false; + Mutex::Autolock autoLock(mLock); if (mWatchForAudioSeekComplete && !mAudioPlayer->isSeeking()) { mWatchForAudioSeekComplete = false; @@ -2239,17 +2244,11 @@ uint32_t AwesomePlayer::flags() const { } void AwesomePlayer::postAudioEOS(int64_t delayUs) { - Mutex::Autolock autoLock(mLock); - postCheckAudioStatusEvent_l(delayUs); + postCheckAudioStatusEvent(delayUs); } void AwesomePlayer::postAudioSeekComplete() { - Mutex::Autolock autoLock(mLock); - postAudioSeekComplete_l(); -} - -void AwesomePlayer::postAudioSeekComplete_l() { - postCheckAudioStatusEvent_l(0 /* delayUs */); + postCheckAudioStatusEvent(0); } status_t AwesomePlayer::setParameter(int key, const Parcel &request) { |