Bug 1350832. P1 - change the type of LOW_AUDIO_USECS to TimeUnit. draft
authorJW Wang <jwwang@mozilla.com>
Mon, 27 Mar 2017 16:15:35 +0800
changeset 552828 eaeb3e3495c659b3cfa9ada9821124d441b41133
parent 552827 8d504462c497bbb487a2237dcb73877796100197
child 552829 49054ce561015d48d9dc34ee9fba0e16d26001f8
push id51481
push userjwwang@mozilla.com
push dateWed, 29 Mar 2017 03:08:18 +0000
bugs1350832
milestone55.0a1
Bug 1350832. P1 - change the type of LOW_AUDIO_USECS to TimeUnit. MozReview-Commit-ID: GEemdvt5ldM
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -87,17 +87,17 @@ using namespace mozilla::media;
 // scale factors on a per-decoder basis. We want to make sure to avoid using these
 // constants directly, so we put them in a namespace.
 namespace detail {
 
 // If audio queue has less than this many usecs of decoded audio, we won't risk
 // trying to decode the video, we'll skip decoding video up to the next
 // keyframe. We may increase this value for an individual decoder if we
 // encounter video frames which take a long time to decode.
-static const uint32_t LOW_AUDIO_USECS = 300000;
+static constexpr auto LOW_AUDIO_USECS = TimeUnit::FromMicroseconds(300000);
 
 // If more than this many usecs of decoded audio is queued, we'll hold off
 // decoding more audio. If we increase the low audio threshold (see
 // LOW_AUDIO_USECS above) we'll also increase this value to ensure it's not
 // less than the low audio threshold.
 static const int64_t AMPLE_AUDIO_USECS = 2000000;
 
 } // namespace detail
@@ -2583,17 +2583,17 @@ MediaDecoderStateMachine::MediaDecoderSt
   mDelayedScheduler(mTaskQueue),
   mCurrentFrameID(0),
   INIT_WATCHABLE(mObservedDuration, TimeUnit()),
   mFragmentEndTime(-1),
   mReader(new MediaDecoderReaderWrapper(mTaskQueue, aReader)),
   mDecodedAudioEndTime(0),
   mDecodedVideoEndTime(0),
   mPlaybackRate(1.0),
-  mLowAudioThresholdUsecs(detail::LOW_AUDIO_USECS),
+  mLowAudioThresholdUsecs(detail::LOW_AUDIO_USECS.ToMicroseconds()),
   mAmpleAudioThresholdUsecs(detail::AMPLE_AUDIO_USECS),
   mAudioCaptured(false),
   mMinimizePreroll(aDecoder->GetMinimizePreroll()),
   mSentLoadedMetadataEvent(false),
   mSentFirstFrameLoadedEvent(false),
   mVideoDecodeSuspended(false),
   mVideoDecodeSuspendTimer(mTaskQueue),
   mOutputStreamManager(new OutputStreamManager()),