Bug 1371188 P3 - remove DecodingState::NeedToSkipToNextKeyframe(); r?jya
MozReview-Commit-ID: CTa7Auzokg6
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -804,17 +804,16 @@ public:
{
return nsPrintfCString("mIsPrerolling=%d", mIsPrerolling);
}
private:
void DispatchDecodeTasksIfNeeded();
void EnsureAudioDecodeTaskQueued();
void EnsureVideoDecodeTaskQueued();
- bool NeedToSkipToNextKeyframe();
void MaybeStartBuffering();
void CheckSlowDecoding(TimeStamp aDecodeStart)
{
// For non async readers, if the requested video sample was slow to
// arrive, increase the amount of audio we buffer to ensure that we
// don't run out of audio. This is unnecessary for async readers,
// since they decode audio and video on different threads so they
@@ -2394,63 +2393,16 @@ DecodingState::EnsureVideoDecodeTaskQueu
if (!mMaster->IsVideoDecoding()
|| mMaster->IsRequestingVideoData()
|| mMaster->IsWaitingVideoData()) {
return;
}
mMaster->RequestVideoData(mMaster->GetMediaTime());
}
-bool
-MediaDecoderStateMachine::
-DecodingState::NeedToSkipToNextKeyframe()
-{
- // Since GetClock() can only be called after starting MediaSink, we return
- // false quickly if it is not started because we won't fall behind playback
- // when not consuming media data.
- if (!mMaster->mMediaSink->IsStarted()) {
- return false;
- }
-
- // Don't skip frame for video-only decoded stream because the clock time of
- // the stream relies on the video frame.
- if (mMaster->mAudioCaptured && !mMaster->HasAudio()) {
- return false;
- }
-
- // We'll skip the video decode to the next keyframe if we're low on
- // audio, or if we're low on video, provided we're not running low on
- // data to decode. If we're running low on downloaded data to decode,
- // we won't start keyframe skipping, as we'll be pausing playback to buffer
- // soon anyway and we'll want to be able to display frames immediately
- // after buffering finishes. We ignore the low audio calculations for
- // readers that are async, as since their audio decode runs on a different
- // task queue it should never run low and skipping won't help their decode.
- bool isLowOnDecodedAudio =
- !Reader()->IsAsync()
- && mMaster->IsAudioDecoding()
- && (mMaster->GetDecodedAudioDuration()
- < mMaster->mLowAudioThreshold.MultDouble(mMaster->mPlaybackRate));
- bool isLowOnDecodedVideo =
- (mMaster->GetClock()
- - mMaster->mDecodedVideoEndTime).MultDouble(mMaster->mPlaybackRate)
- > LOW_VIDEO_THRESHOLD;
- bool lowBuffered = mMaster->HasLowBufferedData();
-
- if ((isLowOnDecodedAudio || isLowOnDecodedVideo) && !lowBuffered) {
- SLOG("Skipping video decode to the next keyframe lowAudio=%d lowVideo=%d "
- "lowUndecoded=%d async=%d",
- isLowOnDecodedAudio, isLowOnDecodedVideo, lowBuffered,
- Reader()->IsAsync());
- return true;
- }
-
- return false;
-}
-
void
MediaDecoderStateMachine::
DecodingState::MaybeStartBuffering()
{
// Buffering makes senses only after decoding first frames.
MOZ_ASSERT(mMaster->mSentFirstFrameLoadedEvent);
// Don't enter buffering when MediaDecoder is not playing.