Bug 1179116. Part 1 - clean up code of MediaDecoderStateMachine::MaybeStartPlayback(). r=cpearce.

This commit is contained in:
JW Wang 2015-07-02 10:34:05 +08:00
Родитель 442d53fa88
Коммит 293366faa9
1 изменённых файлов: 7 добавлений и 6 удалений

Просмотреть файл

@ -1284,17 +1284,19 @@ void MediaDecoderStateMachine::MaybeStartPlayback()
{ {
MOZ_ASSERT(OnTaskQueue()); MOZ_ASSERT(OnTaskQueue());
AssertCurrentThreadInMonitor(); AssertCurrentThreadInMonitor();
MOZ_ASSERT(mState == DECODER_STATE_DECODING ||
mState == DECODER_STATE_COMPLETED);
if (IsPlaying()) { if (IsPlaying()) {
// Logging this case is really spammy - don't do it. // Logging this case is really spammy - don't do it.
return; return;
} }
bool playStatePermits = mPlayState == MediaDecoder::PLAY_STATE_PLAYING; bool playStatePermits = mPlayState == MediaDecoder::PLAY_STATE_PLAYING;
bool decodeStatePermits = mState == DECODER_STATE_DECODING || mState == DECODER_STATE_COMPLETED; if (!playStatePermits || mIsAudioPrerolling || mIsVideoPrerolling) {
if (!playStatePermits || !decodeStatePermits || mIsAudioPrerolling || mIsVideoPrerolling) { DECODER_LOG("Not starting playback [playStatePermits: %d, "
DECODER_LOG("Not starting playback [playStatePermits: %d, decodeStatePermits: %d, " "mIsAudioPrerolling: %d, mIsVideoPrerolling: %d]",
"mIsAudioPrerolling: %d, mIsVideoPrerolling: %d]", (int) playStatePermits, (int) playStatePermits, (int) mIsAudioPrerolling, (int) mIsVideoPrerolling);
(int) decodeStatePermits, (int) mIsAudioPrerolling, (int) mIsVideoPrerolling);
return; return;
} }
@ -2605,7 +2607,6 @@ nsresult MediaDecoderStateMachine::RunStateMachine()
// Notify to allow blocked decoder thread to continue // Notify to allow blocked decoder thread to continue
mDecoder->GetReentrantMonitor().NotifyAll(); mDecoder->GetReentrantMonitor().NotifyAll();
MaybeStartPlayback();
NS_ASSERTION(IsStateMachineScheduled(), "Must have timer scheduled"); NS_ASSERTION(IsStateMachineScheduled(), "Must have timer scheduled");
return NS_OK; return NS_OK;
} }