Bug 1307725. Part 5 - move the check of mIsPrerolling out of MaybeStartPlayback().
Note CompletedState doesn't need to check this flag because prerolling should be done when entering the COMPLETED state.
MozReview-Commit-ID: 4Z7mFYf7wdR
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -590,17 +590,19 @@ public:
if (mMaster->mPlayState != MediaDecoder::PLAY_STATE_PLAYING &&
mMaster->IsPlaying()) {
// We're playing, but the element/decoder is in paused state. Stop
// playing!
mMaster->StopPlayback();
}
// Start playback if necessary so that the clock can be properly queried.
- mMaster->MaybeStartPlayback();
+ if (!mMaster->mIsPrerolling) {
+ mMaster->MaybeStartPlayback();
+ }
mMaster->UpdatePlaybackPositionPeriodically();
MOZ_ASSERT(!mMaster->IsPlaying() ||
mMaster->IsStateMachineScheduled(),
"Must have timer scheduled");
mMaster->MaybeStartBuffering();
@@ -1772,20 +1774,20 @@ void MediaDecoderStateMachine::MaybeStar
mState == DECODER_STATE_COMPLETED);
if (IsPlaying()) {
// Logging this case is really spammy - don't do it.
return;
}
bool playStatePermits = mPlayState == MediaDecoder::PLAY_STATE_PLAYING;
- if (!playStatePermits || mIsPrerolling || mAudioOffloading) {
+ if (!playStatePermits || mAudioOffloading) {
DECODER_LOG("Not starting playback [playStatePermits: %d, "
- "mIsPrerolling: %d, mAudioOffloading: %d]",
- playStatePermits, mIsPrerolling, mAudioOffloading);
+ "mAudioOffloading: %d]",
+ playStatePermits, mAudioOffloading);
return;
}
DECODER_LOG("MaybeStartPlayback() starting playback");
mOnPlaybackEvent.Notify(MediaEventType::PlaybackStarted);
StartMediaSink();
if (!IsPlaying()) {