Bug 1320466 part 3 - implement OnAudioWaited(), OnVideoWaited() and OnNotWaited() callbacks in MDSM; r=jwwang

MozReview-Commit-ID: JA83a23p0Fd

--HG--
extra : rebase_source : dee131eb375c908f584ab7e8d1c42080b9e92cc6
This commit is contained in:
Kaku Kuo 2016-11-26 13:50:51 +08:00
Родитель ce421c2f78
Коммит cd95ac4f30
2 изменённых файлов: 31 добавлений и 2 удалений

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

@ -1998,6 +1998,28 @@ MediaDecoderStateMachine::OnVideoDecoded(MediaData* aVideo,
mStateObj->HandleVideoDecoded(aVideo, aDecodeStartTime);
}
void
MediaDecoderStateMachine::OnAudioWaited(MediaData::Type aType)
{
MOZ_ASSERT(OnTaskQueue());
MOZ_ASSERT(aType == MediaData::AUDIO_DATA);
EnsureAudioDecodeTaskQueued();
}
void
MediaDecoderStateMachine::OnVideoWaited(MediaData::Type aType)
{
MOZ_ASSERT(OnTaskQueue());
MOZ_ASSERT(aType == MediaData::VIDEO_DATA);
EnsureVideoDecodeTaskQueued();
}
void
MediaDecoderStateMachine::OnNotWaited(const WaitForDataRejectValue& aRejection)
{
MOZ_ASSERT(OnTaskQueue());
}
bool
MediaDecoderStateMachine::IsAudioDecoding()
{
@ -2100,14 +2122,18 @@ MediaDecoderStateMachine::SetMediaDecoderReaderWrapperCallback()
mAudioWaitCallback = mReader->AudioWaitCallback().Connect(
mTaskQueue, [this] (WaitCallbackData aData) {
if (aData.is<MediaData::Type>()) {
EnsureAudioDecodeTaskQueued();
OnAudioWaited(aData.as<MediaData::Type>());
} else {
OnNotWaited(aData.as<WaitForDataRejectValue>());
}
});
mVideoWaitCallback = mReader->VideoWaitCallback().Connect(
mTaskQueue, [this] (WaitCallbackData aData) {
if (aData.is<MediaData::Type>()) {
EnsureVideoDecodeTaskQueued();
OnVideoWaited(aData.as<MediaData::Type>());
} else {
OnNotWaited(aData.as<WaitForDataRejectValue>());
}
});
}

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

@ -329,6 +329,9 @@ private:
void OnAudioDecoded(MediaData* aAudio);
void OnVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStartTime);
void OnNotDecoded(MediaData::Type aType, const MediaResult& aError);
void OnAudioWaited(MediaData::Type aType);
void OnVideoWaited(MediaData::Type aType);
void OnNotWaited(const WaitForDataRejectValue& aRejection);
// Resets all state related to decoding and playback, emptying all buffers
// and aborting all pending operations on the decode task queue.