Bug 1353644 - change the type of EXHAUSTED_DATA_MARGIN_USECS to TimeUnit. r=kaku
authorJW Wang <jwwang@mozilla.com>
Wed, 29 Mar 2017 15:04:50 +0800
changeset 400390 a25e24d077b8e16c441f0f622342452108fd79db
parent 400389 e2c9182cddb13a3b3141e39f03302d629397b846
child 400391 992b8a6ae635c5e8f0aa0ab03e161ef243add7b4
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskaku
bugs1353644
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 1353644 - change the type of EXHAUSTED_DATA_MARGIN_USECS to TimeUnit. r=kaku MozReview-Commit-ID: CXc9DjoUc4m
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -136,18 +136,18 @@ static constexpr auto LOW_BUFFER_THRESHO
 
 // LOW_BUFFER_THRESHOLD_USECS needs to be greater than AMPLE_AUDIO_USECS, otherwise
 // the skip-to-keyframe logic can activate when we're running low on data.
 static_assert(LOW_BUFFER_THRESHOLD_USECS > AMPLE_AUDIO_USECS,
               "LOW_BUFFER_THRESHOLD_USECS is too small");
 
 } // namespace detail
 
-// Amount of excess usecs of data to add in to the "should we buffer" calculation.
-static const uint32_t EXHAUSTED_DATA_MARGIN_USECS = 100000;
+// Amount of excess data to add in to the "should we buffer" calculation.
+static constexpr auto EXHAUSTED_DATA_MARGIN = TimeUnit::FromMicroseconds(100000);
 
 static const uint32_t MIN_VIDEO_QUEUE_SIZE = 3;
 static const uint32_t MAX_VIDEO_QUEUE_SIZE = 10;
 #ifdef MOZ_APPLEMEDIA
 static const uint32_t HW_VIDEO_QUEUE_SIZE = 10;
 #else
 static const uint32_t HW_VIDEO_QUEUE_SIZE = 3;
 #endif
@@ -3295,18 +3295,18 @@ MediaDecoderStateMachine::StartMediaSink
   }
 }
 
 bool
 MediaDecoderStateMachine::HasLowDecodedAudio()
 {
   MOZ_ASSERT(OnTaskQueue());
   return IsAudioDecoding()
-         && GetDecodedAudioDuration().ToMicroseconds()
-            < EXHAUSTED_DATA_MARGIN_USECS * mPlaybackRate;
+         && GetDecodedAudioDuration()
+            < EXHAUSTED_DATA_MARGIN.MultDouble(mPlaybackRate);
 }
 
 bool
 MediaDecoderStateMachine::HasLowDecodedVideo()
 {
   MOZ_ASSERT(OnTaskQueue());
   return IsVideoDecoding()
          && VideoQueue().GetSize() < LOW_VIDEO_FRAMES * mPlaybackRate;