Bug 1329897. Part 1 - copy Ensure{Audio,Video}DecodeTaskQueued into BufferingState. r=kaku

Note we remove the checks for mState.

MozReview-Commit-ID: 7uzjzjKDCIj

--HG--
extra : rebase_source : a3c18a977a96edf64b44598cd2244ea20d5f9363
extra : intermediate-source : 294a139aa91dcaaa2d3c2654cbae0fce5317fcbd
extra : source : 1ac775ae3fbb65146c28024e6c19d33b2dd55f66
This commit is contained in:
JW Wang 2017-01-09 20:12:00 +08:00
Родитель 1b9c7c6e5c
Коммит 63a0e6a39f
1 изменённых файлов: 33 добавлений и 6 удалений

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

@ -1651,12 +1651,12 @@ public:
void HandleAudioCanceled() override
{
mMaster->EnsureAudioDecodeTaskQueued();
EnsureAudioDecodeTaskQueued();
}
void HandleVideoCanceled() override
{
mMaster->EnsureVideoDecodeTaskQueued();
EnsureVideoDecodeTaskQueued();
}
void HandleWaitingForAudio() override
@ -1671,12 +1671,12 @@ public:
void HandleAudioWaited(MediaData::Type aType) override
{
mMaster->EnsureAudioDecodeTaskQueued();
EnsureAudioDecodeTaskQueued();
}
void HandleVideoWaited(MediaData::Type aType) override
{
mMaster->EnsureVideoDecodeTaskQueued();
EnsureVideoDecodeTaskQueued();
}
void HandleEndOfAudio() override;
@ -1693,6 +1693,8 @@ public:
private:
void DispatchDecodeTasksIfNeeded();
void EnsureAudioDecodeTaskQueued();
void EnsureVideoDecodeTaskQueued();
TimeStamp mBufferingStart;
@ -2247,15 +2249,40 @@ BufferingState::DispatchDecodeTasksIfNeeded()
{
if (mMaster->IsAudioDecoding() &&
!mMaster->HaveEnoughDecodedAudio()) {
mMaster->EnsureAudioDecodeTaskQueued();
EnsureAudioDecodeTaskQueued();
}
if (mMaster->IsVideoDecoding() &&
!mMaster->HaveEnoughDecodedVideo()) {
mMaster->EnsureVideoDecodeTaskQueued();
EnsureVideoDecodeTaskQueued();
}
}
void
MediaDecoderStateMachine::
BufferingState::EnsureAudioDecodeTaskQueued()
{
if (!mMaster->IsAudioDecoding() ||
mMaster->IsRequestingAudioData() ||
mMaster->IsWaitingAudioData()) {
return;
}
mMaster->RequestAudioData();
}
void
MediaDecoderStateMachine::
BufferingState::EnsureVideoDecodeTaskQueued()
{
if (!mMaster->IsVideoDecoding() ||
mMaster->IsRequestingVideoData() ||
mMaster->IsWaitingVideoData()) {
return;
}
mMaster->RequestVideoData(mMaster->NeedToSkipToNextKeyframe(),
media::TimeUnit::FromMicroseconds(mMaster->GetMediaTime()));
}
void
MediaDecoderStateMachine::
BufferingState::Step()