Bug 713381 - Add null check on decoder state machine. r=roc

This commit is contained in:
Chris Pearce 2012-01-19 09:15:47 +13:00
parent 156afc9357
commit 9b446a7ca7

View File

@ -245,6 +245,7 @@ nsresult nsBuiltinDecoder::ScheduleStateMachineThread()
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
NS_ASSERTION(mDecoderStateMachine,
"Must have state machine to start state machine thread");
NS_ENSURE_STATE(mDecoderStateMachine);
if (mShuttingDown)
return NS_OK;
@ -832,29 +833,19 @@ void nsBuiltinDecoder::ChangeState(PlayState aState)
}
mPlayState = aState;
switch (aState) {
case PLAY_STATE_PAUSED:
/* No action needed */
break;
case PLAY_STATE_PLAYING:
mDecoderStateMachine->Play();
break;
case PLAY_STATE_SEEKING:
mDecoderStateMachine->Seek(mRequestedSeekTime);
mRequestedSeekTime = -1.0;
break;
case PLAY_STATE_LOADING:
/* No action needed */
break;
case PLAY_STATE_START:
/* No action needed */
break;
case PLAY_STATE_ENDED:
/* No action needed */
break;
case PLAY_STATE_SHUTDOWN:
/* No action needed */
break;
if (mDecoderStateMachine) {
switch (aState) {
case PLAY_STATE_PLAYING:
mDecoderStateMachine->Play();
break;
case PLAY_STATE_SEEKING:
mDecoderStateMachine->Seek(mRequestedSeekTime);
mRequestedSeekTime = -1.0;
break;
default:
/* No action needed */
break;
}
}
mReentrantMonitor.NotifyAll();
}
@ -973,7 +964,9 @@ void nsBuiltinDecoder::Resume(bool aForceBuffering)
}
if (aForceBuffering) {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
mDecoderStateMachine->StartBuffering();
if (mDecoderStateMachine) {
mDecoderStateMachine->StartBuffering();
}
}
}