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