Bug 1351203. P1 - change the type of LOW_VIDEO_THRESHOLD_USECS to TimeUnit.
MozReview-Commit-ID: 47uMuLTPFPt
--- 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;