Merge "Guard the audio notifications with a separate lock to avoid deadlocks during reset."
This commit is contained in:
committed by
Android (Google) Code Review
commit
ae51008564
@@ -978,7 +978,7 @@ status_t AwesomePlayer::startAudioPlayer_l(bool sendErrorNotification) {
|
|||||||
CHECK(!mAudioPlayer->isSeeking());
|
CHECK(!mAudioPlayer->isSeeking());
|
||||||
|
|
||||||
// We will have finished the seek while starting the audio player.
|
// We will have finished the seek while starting the audio player.
|
||||||
postAudioSeekComplete_l();
|
postAudioSeekComplete();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mAudioPlayer->resume();
|
mAudioPlayer->resume();
|
||||||
@@ -1877,7 +1877,8 @@ void AwesomePlayer::postVideoLagEvent_l() {
|
|||||||
mQueue.postEventWithDelay(mVideoLagEvent, 1000000ll);
|
mQueue.postEventWithDelay(mVideoLagEvent, 1000000ll);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AwesomePlayer::postCheckAudioStatusEvent_l(int64_t delayUs) {
|
void AwesomePlayer::postCheckAudioStatusEvent(int64_t delayUs) {
|
||||||
|
Mutex::Autolock autoLock(mAudioLock);
|
||||||
if (mAudioStatusEventPending) {
|
if (mAudioStatusEventPending) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1886,14 +1887,18 @@ void AwesomePlayer::postCheckAudioStatusEvent_l(int64_t delayUs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AwesomePlayer::onCheckAudioStatus() {
|
void AwesomePlayer::onCheckAudioStatus() {
|
||||||
Mutex::Autolock autoLock(mLock);
|
{
|
||||||
if (!mAudioStatusEventPending) {
|
Mutex::Autolock autoLock(mAudioLock);
|
||||||
// Event was dispatched and while we were blocking on the mutex,
|
if (!mAudioStatusEventPending) {
|
||||||
// has already been cancelled.
|
// Event was dispatched and while we were blocking on the mutex,
|
||||||
return;
|
// has already been cancelled.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mAudioStatusEventPending = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mAudioStatusEventPending = false;
|
Mutex::Autolock autoLock(mLock);
|
||||||
|
|
||||||
if (mWatchForAudioSeekComplete && !mAudioPlayer->isSeeking()) {
|
if (mWatchForAudioSeekComplete && !mAudioPlayer->isSeeking()) {
|
||||||
mWatchForAudioSeekComplete = false;
|
mWatchForAudioSeekComplete = false;
|
||||||
@@ -2239,17 +2244,11 @@ uint32_t AwesomePlayer::flags() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AwesomePlayer::postAudioEOS(int64_t delayUs) {
|
void AwesomePlayer::postAudioEOS(int64_t delayUs) {
|
||||||
Mutex::Autolock autoLock(mLock);
|
postCheckAudioStatusEvent(delayUs);
|
||||||
postCheckAudioStatusEvent_l(delayUs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AwesomePlayer::postAudioSeekComplete() {
|
void AwesomePlayer::postAudioSeekComplete() {
|
||||||
Mutex::Autolock autoLock(mLock);
|
postCheckAudioStatusEvent(0);
|
||||||
postAudioSeekComplete_l();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AwesomePlayer::postAudioSeekComplete_l() {
|
|
||||||
postCheckAudioStatusEvent_l(0 /* delayUs */);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t AwesomePlayer::setParameter(int key, const Parcel &request) {
|
status_t AwesomePlayer::setParameter(int key, const Parcel &request) {
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ private:
|
|||||||
mutable Mutex mLock;
|
mutable Mutex mLock;
|
||||||
Mutex mMiscStateLock;
|
Mutex mMiscStateLock;
|
||||||
mutable Mutex mStatsLock;
|
mutable Mutex mStatsLock;
|
||||||
|
Mutex mAudioLock;
|
||||||
|
|
||||||
OMXClient mClient;
|
OMXClient mClient;
|
||||||
TimedEventQueue mQueue;
|
TimedEventQueue mQueue;
|
||||||
@@ -223,7 +224,7 @@ private:
|
|||||||
void postVideoEvent_l(int64_t delayUs = -1);
|
void postVideoEvent_l(int64_t delayUs = -1);
|
||||||
void postBufferingEvent_l();
|
void postBufferingEvent_l();
|
||||||
void postStreamDoneEvent_l(status_t status);
|
void postStreamDoneEvent_l(status_t status);
|
||||||
void postCheckAudioStatusEvent_l(int64_t delayUs);
|
void postCheckAudioStatusEvent(int64_t delayUs);
|
||||||
void postVideoLagEvent_l();
|
void postVideoLagEvent_l();
|
||||||
status_t play_l();
|
status_t play_l();
|
||||||
|
|
||||||
@@ -295,7 +296,6 @@ private:
|
|||||||
void ensureCacheIsFetching_l();
|
void ensureCacheIsFetching_l();
|
||||||
|
|
||||||
status_t startAudioPlayer_l(bool sendErrorNotification = true);
|
status_t startAudioPlayer_l(bool sendErrorNotification = true);
|
||||||
void postAudioSeekComplete_l();
|
|
||||||
|
|
||||||
void shutdownVideoDecoder_l();
|
void shutdownVideoDecoder_l();
|
||||||
status_t setNativeWindow_l(const sp<ANativeWindow> &native);
|
status_t setNativeWindow_l(const sp<ANativeWindow> &native);
|
||||||
|
|||||||
Reference in New Issue
Block a user