Bug 1322800 part 8 - move NextFrameSeekTask::IsVideoRequestPending(); r?jwwang
MozReview-Commit-ID: 9MEHVQUt7T0
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1391,17 +1391,17 @@ private:
->Then(OwnerThread(), __func__,
[this] (const SeekTaskResolveValue& aValue) {
OnSeekTaskResolved(aValue);
},
[this] (const SeekTaskRejectValue& aValue) {
OnSeekTaskRejected(aValue);
}));
- if (!mTask->IsVideoRequestPending() && NeedMoreVideo()) {
+ if (!IsVideoRequestPending() && NeedMoreVideo()) {
RequestVideoData();
}
MaybeFinishSeek(); // Might resolve mSeekTaskPromise and modify audio queue.
}
void HandleAudioDecoded(MediaData* aAudio) override
{
MOZ_ASSERT(aAudio);
@@ -1599,28 +1599,33 @@ private:
{
// Need to request video when we have none and video queue is not finished.
return mTask->mVideoQueue.GetSize() == 0 &&
!mTask->mSeekedVideoData &&
!mTask->mVideoQueue.IsFinished() &&
!mTask->mIsVideoQueueFinished;
}
+ bool IsVideoRequestPending() const
+ {
+ return Reader()->IsRequestingVideoData() || Reader()->IsWaitingVideoData();
+ }
+
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() && !NeedMoreVideo();
+ return !IsVideoRequestPending() && !NeedMoreVideo();
}
void MaybeFinishSeek()
{
if (IsAudioSeekComplete() && IsVideoSeekComplete()) {
mTask->UpdateSeekTargetTime();
auto time = mTask->mTarget.GetTime().ToMicroseconds();
--- a/dom/media/NextFrameSeekTask.cpp
+++ b/dom/media/NextFrameSeekTask.cpp
@@ -97,23 +97,16 @@ NextFrameSeekTask::Seek(const media::Tim
{
AssertOwnerThread();
RefPtr<SeekTaskPromise> promise = mSeekTaskPromise.Ensure(__func__);
return promise;
}
-bool
-NextFrameSeekTask::IsVideoRequestPending() const
-{
- AssertOwnerThread();
- return mReader->IsRequestingVideoData() || mReader->IsWaitingVideoData();
-}
-
void
NextFrameSeekTask::UpdateSeekTargetTime()
{
AssertOwnerThread();
RefPtr<MediaData> data = mVideoQueue.PeekFront();
if (data) {
mTarget.SetTime(TimeUnit::FromMicroseconds(data->mTime));
--- a/dom/media/NextFrameSeekTask.h
+++ b/dom/media/NextFrameSeekTask.h
@@ -49,18 +49,16 @@ public:
void HandleAudioWaited(MediaData::Type aType) override;
void HandleVideoWaited(MediaData::Type aType) override;
void HandleNotWaited(const WaitForDataRejectValue& aRejection) override;
~NextFrameSeekTask();
- bool IsVideoRequestPending() 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();
/*
* Data shared with MDSM.
*/
MediaQueue<MediaData>& mAudioQueue;