Bug 1352319. P4 - move AudioPrerollUsecs/VideoPrerollFrames into DecodingState. r=kaku

MozReview-Commit-ID: 3VuDj1TXZV2

--HG--
extra : rebase_source : 53471b886ee48e845e31b70e9e13d82b0620a6a7
extra : source : 383119c9b722b892d300cb56b92116af3285b60a
This commit is contained in:
JW Wang 2017-03-28 15:38:34 +08:00
Родитель 428f953b53
Коммит 747b792884
2 изменённых файлов: 18 добавлений и 20 удалений

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

@ -837,18 +837,34 @@ private:
}
}
// At the start of decoding we want to "preroll" the decode until we've
// got a few frames decoded before we consider whether decode is falling
// behind. Otherwise our "we're falling behind" logic will trigger
// unnecessarily if we start playing as soon as the first sample is
// decoded. These two fields store how many video frames and audio
// samples we must consume before are considered to be finished prerolling.
uint32_t AudioPrerollUsecs() const
{
return mMaster->mAmpleAudioThreshold.ToMicroseconds() / 2;
}
uint32_t VideoPrerollFrames() const
{
return mMaster->GetAmpleVideoFrames() / 2;
}
bool DonePrerollingAudio()
{
return !mMaster->IsAudioDecoding()
|| mMaster->GetDecodedAudioDuration()
>= mMaster->AudioPrerollUsecs() * mMaster->mPlaybackRate;
>= AudioPrerollUsecs() * mMaster->mPlaybackRate;
}
bool DonePrerollingVideo()
{
return !mMaster->IsVideoDecoding()
|| static_cast<uint32_t>(mMaster->VideoQueue().GetSize())
>= mMaster->VideoPrerollFrames() * mMaster->mPlaybackRate + 1;
>= VideoPrerollFrames() * mMaster->mPlaybackRate + 1;
}
void MaybeStopPrerolling()

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

@ -593,24 +593,6 @@ private:
// we detect that the decode can't keep up with rendering.
media::TimeUnit mAmpleAudioThreshold;
// At the start of decoding we want to "preroll" the decode until we've
// got a few frames decoded before we consider whether decode is falling
// behind. Otherwise our "we're falling behind" logic will trigger
// unnecessarily if we start playing as soon as the first sample is
// decoded. These two fields store how many video frames and audio
// samples we must consume before are considered to be finished prerolling.
uint32_t AudioPrerollUsecs() const
{
MOZ_ASSERT(OnTaskQueue());
return mAmpleAudioThreshold.ToMicroseconds() / 2;
}
uint32_t VideoPrerollFrames() const
{
MOZ_ASSERT(OnTaskQueue());
return GetAmpleVideoFrames() / 2;
}
// Only one of a given pair of ({Audio,Video}DataPromise, WaitForDataPromise)
// should exist at any given moment.
using AudioDataPromise = MediaDecoderReader::AudioDataPromise;