Bug 1307725. Part 8 - move DonePrerolling{Audio,Video} into DecodingState.
MozReview-Commit-ID: I173Qo7hH9X
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -697,21 +697,35 @@ private:
SLOG("Slow video decode, set "
"mLowAudioThresholdUsecs=%lld "
"mAmpleAudioThresholdUsecs=%lld",
mMaster->mLowAudioThresholdUsecs,
mMaster->mAmpleAudioThresholdUsecs);
}
}
+ bool DonePrerollingAudio()
+ {
+ return !mMaster->IsAudioDecoding() ||
+ mMaster->GetDecodedAudioDuration() >=
+ mMaster->AudioPrerollUsecs() * mMaster->mPlaybackRate;
+ }
+
+ bool DonePrerollingVideo()
+ {
+ return !mMaster->IsVideoDecoding() ||
+ static_cast<uint32_t>(mMaster->VideoQueue().GetSize()) >=
+ mMaster->VideoPrerollFrames() * mMaster->mPlaybackRate + 1;
+ }
+
void MaybeStopPrerolling()
{
if (mIsPrerolling &&
- (mMaster->DonePrerollingAudio() || Reader()->IsWaitingAudioData()) &&
- (mMaster->DonePrerollingVideo() || Reader()->IsWaitingVideoData())) {
+ (DonePrerollingAudio() || Reader()->IsWaitingAudioData()) &&
+ (DonePrerollingVideo() || Reader()->IsWaitingVideoData())) {
mIsPrerolling = false;
// Check if we can start playback.
mMaster->ScheduleStateMachine();
}
}
// Time at which we started decoding.
TimeStamp mDecodeStartTime;
--- a/dom/media/MediaDecoderStateMachine.h
+++ b/dom/media/MediaDecoderStateMachine.h
@@ -672,31 +672,16 @@ private:
}
uint32_t VideoPrerollFrames() const
{
MOZ_ASSERT(OnTaskQueue());
return GetAmpleVideoFrames() / 2;
}
- bool DonePrerollingAudio()
- {
- MOZ_ASSERT(OnTaskQueue());
- return !IsAudioDecoding() ||
- GetDecodedAudioDuration() >= AudioPrerollUsecs() * mPlaybackRate;
- }
-
- bool DonePrerollingVideo()
- {
- MOZ_ASSERT(OnTaskQueue());
- return !IsVideoDecoding() ||
- static_cast<uint32_t>(VideoQueue().GetSize()) >=
- VideoPrerollFrames() * mPlaybackRate + 1;
- }
-
// Only one of a given pair of ({Audio,Video}DataPromise, WaitForDataPromise)
// should exist at any given moment.
MediaEventListener mAudioCallback;
MediaEventListener mVideoCallback;
MediaEventListener mAudioWaitCallback;
MediaEventListener mVideoWaitCallback;