From 285e8bf1720ce77ba40e0c20a9632199bde95808 Mon Sep 17 00:00:00 2001 From: JW Wang Date: Tue, 28 Mar 2017 17:27:56 +0800 Subject: [PATCH] Bug 1353607. P6 - use TimeUnit in CheckSlowDecoding(). r=kikuo MozReview-Commit-ID: 524aRA1uUaQ --HG-- extra : rebase_source : 9983ee9167c7e6420d7ebd529be8a985027c40d5 extra : intermediate-source : 56e1187c40b910d8cc233bd1dd86c963d0bdb249 extra : source : 29470ceae137940b6432a402249a56a82572adf0 --- dom/media/MediaDecoderStateMachine.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index a2288ec3d35f..af35d2d620de 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -815,13 +815,12 @@ private: } 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,