Bug 1322800 part 6 - move NextFrameSeekTask::Is{Audio,Video}SeekComplete(); r=jwwang

MozReview-Commit-ID: D4grujhMgHt

--HG--
extra : rebase_source : 62f9b98b3923d8727eb89e6ab61b2dd51d459030
This commit is contained in:
Kaku Kuo 2016-12-14 15:10:25 +08:00
Родитель 72758e96dc
Коммит e2472a1496
3 изменённых файлов: 15 добавлений и 23 удалений

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

@ -1593,9 +1593,23 @@ private:
Reader()->RequestVideoData(false, media::TimeUnit());
}
bool IsAudioSeekComplete() const
{
// Don't finish seek until there are no pending requests. Otherwise, we might
// lose audio samples for the promise is resolved asynchronously.
return !Reader()->IsRequestingAudioData() && !Reader()->IsWaitingAudioData();
}
bool IsVideoSeekComplete() const
{
// Don't finish seek until there are no pending requests. Otherwise, we might
// lose video samples for the promise is resolved asynchronously.
return !mTask->IsVideoRequestPending() && !mTask->NeedMoreVideo();
}
void MaybeFinishSeek()
{
if (mTask->IsAudioSeekComplete() && mTask->IsVideoSeekComplete()) {
if (IsAudioSeekComplete() && IsVideoSeekComplete()) {
mTask->UpdateSeekTargetTime();
auto time = mTask->mTarget.GetTime().ToMicroseconds();

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

@ -120,24 +120,6 @@ NextFrameSeekTask::IsVideoRequestPending() const
return mReader->IsRequestingVideoData() || mReader->IsWaitingVideoData();
}
bool
NextFrameSeekTask::IsAudioSeekComplete() const
{
AssertOwnerThread();
// Don't finish seek until there are no pending requests. Otherwise, we might
// lose audio samples for the promise is resolved asynchronously.
return !mReader->IsRequestingAudioData() && !mReader->IsWaitingAudioData();
}
bool
NextFrameSeekTask::IsVideoSeekComplete() const
{
AssertOwnerThread();
// Don't finish seek until there are no pending requests. Otherwise, we might
// lose video samples for the promise is resolved asynchronously.
return !IsVideoRequestPending() && !NeedMoreVideo();
}
void
NextFrameSeekTask::UpdateSeekTargetTime()
{

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

@ -58,10 +58,6 @@ public:
bool IsVideoRequestPending() const;
bool IsAudioSeekComplete() const;
bool IsVideoSeekComplete() const;
// Update the seek target's time before resolving this seek task, the updated
// time will be used in the MDSM::SeekCompleted() to update the MDSM's position.
void UpdateSeekTargetTime();