Bug 1353607. P12 - replace |TimeUnit::ToMicroseconds()*double| with |TimeUnit::MultDouble()|.
MozReview-Commit-ID: 3QIBCCNf5G0
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -843,18 +843,18 @@ private:
uint32_t VideoPrerollFrames() const
{
return mMaster->GetAmpleVideoFrames() / 2;
}
bool DonePrerollingAudio()
{
return !mMaster->IsAudioDecoding()
- || mMaster->GetDecodedAudioDuration().ToMicroseconds()
- >= AudioPrerollThreshold().ToMicroseconds() * mMaster->mPlaybackRate;
+ || mMaster->GetDecodedAudioDuration()
+ >= AudioPrerollThreshold().MultDouble(mMaster->mPlaybackRate);
}
bool DonePrerollingVideo()
{
return !mMaster->IsVideoDecoding()
|| static_cast<uint32_t>(mMaster->VideoQueue().GetSize())
>= VideoPrerollFrames() * mMaster->mPlaybackRate + 1;
}
@@ -2306,22 +2306,22 @@ DecodingState::NeedToSkipToNextKeyframe(
// we won't start keyframe skipping, as we'll be pausing playback to buffer
// soon anyway and we'll want to be able to display frames immediately
// after buffering finishes. We ignore the low audio calculations for
// readers that are async, as since their audio decode runs on a different
// task queue it should never run low and skipping won't help their decode.
bool isLowOnDecodedAudio =
!Reader()->IsAsync()
&& mMaster->IsAudioDecoding()
- && (mMaster->GetDecodedAudioDuration().ToMicroseconds()
- < mMaster->mLowAudioThreshold.ToMicroseconds() * mMaster->mPlaybackRate);
+ && (mMaster->GetDecodedAudioDuration()
+ < mMaster->mLowAudioThreshold.MultDouble(mMaster->mPlaybackRate));
bool isLowOnDecodedVideo =
- (mMaster->GetClock() - mMaster->mDecodedVideoEndTime).ToMicroseconds()
- * mMaster->mPlaybackRate
- > LOW_VIDEO_THRESHOLD.ToMicroseconds();
+ (mMaster->GetClock()
+ - mMaster->mDecodedVideoEndTime).MultDouble(mMaster->mPlaybackRate)
+ > LOW_VIDEO_THRESHOLD;
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;
@@ -2758,19 +2758,19 @@ MediaDecoderStateMachine::GetDecodedAudi
// MediaSink not started. All audio samples are in the queue.
return TimeUnit::FromMicroseconds(AudioQueue().Duration());
}
bool
MediaDecoderStateMachine::HaveEnoughDecodedAudio()
{
MOZ_ASSERT(OnTaskQueue());
- auto ampleAudioUSecs = mAmpleAudioThreshold.ToMicroseconds() * mPlaybackRate;
+ auto ampleAudio = mAmpleAudioThreshold.MultDouble(mPlaybackRate);
return AudioQueue().GetSize() > 0
- && GetDecodedAudioDuration().ToMicroseconds() >= ampleAudioUSecs;
+ && GetDecodedAudioDuration() >= ampleAudio;
}
bool MediaDecoderStateMachine::HaveEnoughDecodedVideo()
{
MOZ_ASSERT(OnTaskQueue());
return VideoQueue().GetSize() >= GetAmpleVideoFrames() * mPlaybackRate + 1;
}