Bug 1306186. Part 1 - remove checks for mIsAudioPrerolling and mIsVideoPrerolling from NeedToSkipToNextKeyframe(). draft
authorJW Wang <jwwang@mozilla.com>
Thu, 29 Sep 2016 11:22:36 +0800
changeset 419970 b344f86fc7f2221c6a4e5c61197aec635236ec48
parent 419969 2c654bdb8e7f1e2fb259f142739f3d88c0ad9610
child 419971 03aa59e75347cdafb33792bc8fe08c5824dfaede
push id31057
push userjwwang@mozilla.com
push dateMon, 03 Oct 2016 02:44:04 +0000
bugs1306186
milestone52.0a1
Bug 1306186. Part 1 - remove checks for mIsAudioPrerolling and mIsVideoPrerolling from NeedToSkipToNextKeyframe(). When we reach |isLowOnDecodedAudio = ...|, mMediaSink->IsStarted() must be true which means prerolling is done and both mIsAudioPrerolling and mIsVideoPrerolling are false. MozReview-Commit-ID: Bt1dMw692jI
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -989,22 +989,21 @@ MediaDecoderStateMachine::NeedToSkipToNe
   // 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 = !mReader->IsAsync() &&
-                             !mIsAudioPrerolling && IsAudioDecoding() &&
+                             IsAudioDecoding() &&
                              (GetDecodedAudioDuration() <
                               mLowAudioThresholdUsecs * mPlaybackRate);
-  bool isLowOnDecodedVideo = !mIsVideoPrerolling &&
-                             ((GetClock() - mDecodedVideoEndTime) * mPlaybackRate >
-                              LOW_VIDEO_THRESHOLD_USECS);
+  bool isLowOnDecodedVideo = (GetClock() - mDecodedVideoEndTime) * mPlaybackRate >
+                             LOW_VIDEO_THRESHOLD_USECS;
   bool lowBuffered = HasLowBufferedData();
 
   if ((isLowOnDecodedAudio || isLowOnDecodedVideo) && !lowBuffered) {
     DECODER_LOG("Skipping video decode to the next keyframe lowAudio=%d lowVideo=%d lowUndecoded=%d async=%d",
                 isLowOnDecodedAudio, isLowOnDecodedVideo, lowBuffered, mReader->IsAsync());
     return true;
   }