Bug 1351203. P1 - change the type of LOW_VIDEO_THRESHOLD_USECS to TimeUnit. r=kaku
authorJW Wang <jwwang@mozilla.com>
Tue, 28 Mar 2017 14:43:56 +0800
changeset 350682 d3272b0223e69ee0ab2a917b97df3ff1717a544e
parent 350681 3c95bd84c16d85437fb68f6081734723a58271f2
child 350683 c9b57523c9b4468b000d6fd06c06e8d78c7b3318
push id88685
push usercbook@mozilla.com
push dateFri, 31 Mar 2017 12:48:11 +0000
treeherdermozilla-inbound@aece477a513e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskaku
bugs1351203
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1351203. P1 - change the type of LOW_VIDEO_THRESHOLD_USECS to TimeUnit. r=kaku MozReview-Commit-ID: 47uMuLTPFPt
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -108,17 +108,17 @@ static constexpr auto AMPLE_AUDIO_THRESH
 // we're not "prerolling video", we'll skip the video up to the next keyframe
 // which is at or after the current playback position.
 static const uint32_t LOW_VIDEO_FRAMES = 2;
 
 // Threshold in usecs that used to check if we are low on decoded video.
 // If the last video frame's end time |mDecodedVideoEndTime| is more than
 // |LOW_VIDEO_THRESHOLD_USECS*mPlaybackRate| after the current clock in
 // Advanceframe(), the video decode is lagging, and we skip to next keyframe.
-static const int32_t LOW_VIDEO_THRESHOLD_USECS = 60000;
+static constexpr auto LOW_VIDEO_THRESHOLD_USECS = TimeUnit::FromMicroseconds(60000);
 
 // Arbitrary "frame duration" when playing only audio.
 static const int AUDIO_DURATION_USECS = 40000;
 
 // If we increase our "low audio threshold" (see LOW_AUDIO_THRESHOLD above), we
 // use this as a factor in all our calculations. Increasing this will cause
 // us to be more likely to increase our low audio threshold, and to
 // increase it by more.
@@ -2301,17 +2301,17 @@ DecodingState::NeedToSkipToNextKeyframe(
   bool isLowOnDecodedAudio =
     !Reader()->IsAsync()
     && mMaster->IsAudioDecoding()
     && (mMaster->GetDecodedAudioDuration()
         < mMaster->mLowAudioThreshold.ToMicroseconds() * mMaster->mPlaybackRate);
   bool isLowOnDecodedVideo =
     (mMaster->GetClock() - mMaster->mDecodedVideoEndTime)
     * mMaster->mPlaybackRate
-    > LOW_VIDEO_THRESHOLD_USECS;
+    > LOW_VIDEO_THRESHOLD_USECS.ToMicroseconds();
   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;