Bug 1057954 - MediaDecoder::PlaybackEnded() should do nothing in dormant state. r=kinetik.

This commit is contained in:
JW Wang 2014-09-02 20:07:00 +02:00
parent 09f5e63a9e
commit e1edda90ea

View File

@ -130,12 +130,10 @@ void MediaDecoder::SetDormantIfNecessary(bool aDormant)
MOZ_ASSERT(NS_IsMainThread());
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
if (!mDecoderStateMachine || !mDecoderStateMachine->IsDormantNeeded() || (mPlayState == PLAY_STATE_SHUTDOWN)) {
return;
}
if (mIsDormant == aDormant) {
// no change to dormant state
if (!mDecoderStateMachine ||
!mDecoderStateMachine->IsDormantNeeded() ||
mPlayState == PLAY_STATE_SHUTDOWN ||
mIsDormant == aDormant) {
return;
}
@ -149,16 +147,11 @@ void MediaDecoder::SetDormantIfNecessary(bool aDormant)
SecondsToUsecs(mCurrentTime, timeUsecs);
mRequestedSeekTarget = SeekTarget(timeUsecs, SeekTarget::Accurate);
if (mPlayState == PLAY_STATE_PLAYING){
mNextState = PLAY_STATE_PLAYING;
} else {
mNextState = PLAY_STATE_PAUSED;
}
mNextState = mPlayState;
mIsDormant = true;
mIsExitingDormant = false;
ChangeState(PLAY_STATE_LOADING);
} else if ((aDormant != true) && (mPlayState == PLAY_STATE_LOADING)) {
} else if (!aDormant && mPlayState == PLAY_STATE_LOADING) {
// exit dormant state
// trigger to state machine.
mDecoderStateMachine->SetDormant(false);
@ -170,7 +163,9 @@ void MediaDecoder::Pause()
{
MOZ_ASSERT(NS_IsMainThread());
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
if ((mPlayState == PLAY_STATE_LOADING && mIsDormant) || mPlayState == PLAY_STATE_SEEKING || mPlayState == PLAY_STATE_ENDED) {
if ((mPlayState == PLAY_STATE_LOADING && mIsDormant) ||
mPlayState == PLAY_STATE_SEEKING ||
mPlayState == PLAY_STATE_ENDED) {
mNextState = PLAY_STATE_PAUSED;
return;
}
@ -869,8 +864,11 @@ void MediaDecoder::PlaybackEnded()
{
MOZ_ASSERT(NS_IsMainThread());
if (mShuttingDown || mPlayState == MediaDecoder::PLAY_STATE_SEEKING)
if (mShuttingDown ||
mPlayState == PLAY_STATE_SEEKING ||
(mPlayState == PLAY_STATE_LOADING && mIsDormant)) {
return;
}
{
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());