Bug 1353607. P6 - use TimeUnit in CheckSlowDecoding().
MozReview-Commit-ID: 524aRA1uUaQ
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -810,23 +810,22 @@ private:
// don't run out of audio. This is unnecessary for async readers,
// since they decode audio and video on different threads so they
// are unlikely to run out of decoded audio.
if (Reader()->IsAsync()) {
return;
}
TimeDuration decodeTime = TimeStamp::Now() - aDecodeStart;
- int64_t adjustedTime = THRESHOLD_FACTOR * DurationToUsecs(decodeTime);
- if (adjustedTime > mMaster->mLowAudioThreshold.ToMicroseconds()
+ auto adjusted = TimeUnit::FromTimeDuration(decodeTime * THRESHOLD_FACTOR);
+ if (adjusted > mMaster->mLowAudioThreshold
&& !mMaster->HasLowBufferedData())
{
mMaster->mLowAudioThreshold = std::min(
- TimeUnit::FromMicroseconds(adjustedTime),
- mMaster->mAmpleAudioThreshold);
+ adjusted, mMaster->mAmpleAudioThreshold);
mMaster->mAmpleAudioThreshold = std::max(
mMaster->mLowAudioThreshold * THRESHOLD_FACTOR,
mMaster->mAmpleAudioThreshold);
SLOG("Slow video decode, set "
"mLowAudioThreshold=%" PRId64
" mAmpleAudioThreshold=%" PRId64,