Bug 1353644 - change the type of EXHAUSTED_DATA_MARGIN_USECS to TimeUnit.
MozReview-Commit-ID: CXc9DjoUc4m
--- 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
@@ -3289,18 +3289,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;