Bug 1350832. P2 - change the type of mLowAudioThresholdUsecs to TimeUnit. r=kikuo

MozReview-Commit-ID: AurJRSuZkkg

--HG--
extra : rebase_source : 0fd06ad51f35d203c094d26c74a2d098f53bd36b
extra : source : 7ec0cc1999c03a09313c7ef85c90c8537440db8d
This commit is contained in:
JW Wang 2017-03-27 16:22:09 +08:00
Родитель 52f41d64eb
Коммит faade86218
2 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -814,20 +814,20 @@ private:
TimeDuration decodeTime = TimeStamp::Now() - aDecodeStart;
int64_t adjustedTime = THRESHOLD_FACTOR * DurationToUsecs(decodeTime);
if (adjustedTime > mMaster->mLowAudioThresholdUsecs
if (adjustedTime > mMaster->mLowAudioThresholdUsecs.ToMicroseconds()
&& !mMaster->HasLowBufferedData())
{
mMaster->mLowAudioThresholdUsecs =
std::min(adjustedTime, mMaster->mAmpleAudioThresholdUsecs);
mMaster->mLowAudioThresholdUsecs = TimeUnit::FromMicroseconds(
std::min(adjustedTime, mMaster->mAmpleAudioThresholdUsecs));
mMaster->mAmpleAudioThresholdUsecs =
std::max(THRESHOLD_FACTOR * mMaster->mLowAudioThresholdUsecs,
std::max(THRESHOLD_FACTOR * mMaster->mLowAudioThresholdUsecs.ToMicroseconds(),
mMaster->mAmpleAudioThresholdUsecs);
SLOG("Slow video decode, set "
"mLowAudioThresholdUsecs=%" PRId64
" mAmpleAudioThresholdUsecs=%" PRId64,
mMaster->mLowAudioThresholdUsecs,
mMaster->mLowAudioThresholdUsecs.ToMicroseconds(),
mMaster->mAmpleAudioThresholdUsecs);
}
}
@ -2299,7 +2299,7 @@ DecodingState::NeedToSkipToNextKeyframe()
!Reader()->IsAsync()
&& mMaster->IsAudioDecoding()
&& (mMaster->GetDecodedAudioDuration()
< mMaster->mLowAudioThresholdUsecs * mMaster->mPlaybackRate);
< mMaster->mLowAudioThresholdUsecs.ToMicroseconds() * mMaster->mPlaybackRate);
bool isLowOnDecodedVideo =
(mMaster->GetClock() - mMaster->mDecodedVideoEndTime)
* mMaster->mPlaybackRate
@ -2594,7 +2594,7 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
mDecodedAudioEndTime(0),
mDecodedVideoEndTime(0),
mPlaybackRate(1.0),
mLowAudioThresholdUsecs(detail::LOW_AUDIO_USECS.ToMicroseconds()),
mLowAudioThresholdUsecs(detail::LOW_AUDIO_USECS),
mAmpleAudioThresholdUsecs(detail::AMPLE_AUDIO_USECS),
mAudioCaptured(false),
mMinimizePreroll(aDecoder->GetMinimizePreroll()),

Просмотреть файл

@ -583,7 +583,7 @@ private:
// decode video frames, in order to reduce the chance of audio underruns.
// Note that we don't ever reset this threshold, it only ever grows as
// we detect that the decode can't keep up with rendering.
int64_t mLowAudioThresholdUsecs;
media::TimeUnit mLowAudioThresholdUsecs;
// Our "ample" audio threshold. Once we've this much audio decoded, we
// pause decoding. If we increase mLowAudioThresholdUsecs, we'll also