Bug 1322799 part 4 - move AccurateSeekTask::Request{Audio,Video}Data(); r?jwwang draft
authorKaku Kuo <kaku@mozilla.com>
Fri, 09 Dec 2016 10:34:40 -1000
changeset 449366 ce97116e32900b363a6f32a58caf07ea93d125a6
parent 449365 5776c735204bed3ac4dfdd6f79f491b21576ff1d
child 449367 3b7fd1027253b9ac2eb807136e0f5e76ec897c49
push id38552
push userbmo:kaku@mozilla.com
push dateWed, 14 Dec 2016 02:51:42 +0000
reviewersjwwang
bugs1322799
milestone53.0a1
Bug 1322799 part 4 - move AccurateSeekTask::Request{Audio,Video}Data(); r?jwwang MozReview-Commit-ID: 13vA6yDmN7d
dom/media/AccurateSeekTask.cpp
dom/media/AccurateSeekTask.h
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/AccurateSeekTask.cpp
+++ b/dom/media/AccurateSeekTask.cpp
@@ -250,36 +250,16 @@ AccurateSeekTask::HandleNotWaited(const 
 RefPtr<AccurateSeekTask::SeekTaskPromise>
 AccurateSeekTask::Seek(const media::TimeUnit& aDuration)
 {
   AssertOwnerThread();
 
   return mSeekTaskPromise.Ensure(__func__);
 }
 
-void
-AccurateSeekTask::RequestAudioData()
-{
-  AssertOwnerThread();
-  MOZ_ASSERT(!mDoneAudioSeeking);
-  MOZ_ASSERT(!mReader->IsRequestingAudioData());
-  MOZ_ASSERT(!mReader->IsWaitingAudioData());
-  mReader->RequestAudioData();
-}
-
-void
-AccurateSeekTask::RequestVideoData()
-{
-  AssertOwnerThread();
-  MOZ_ASSERT(!mDoneVideoSeeking);
-  MOZ_ASSERT(!mReader->IsRequestingVideoData());
-  MOZ_ASSERT(!mReader->IsWaitingVideoData());
-  mReader->RequestVideoData(false, media::TimeUnit());
-}
-
 nsresult
 AccurateSeekTask::DropAudioUpToSeekTarget(MediaData* aSample)
 {
   AssertOwnerThread();
 
   RefPtr<AudioData> audio(aSample->As<AudioData>());
   MOZ_ASSERT(audio && mTarget.IsAccurate());
 
--- a/dom/media/AccurateSeekTask.h
+++ b/dom/media/AccurateSeekTask.h
@@ -38,20 +38,16 @@ public:
   void HandleAudioWaited(MediaData::Type aType) override;
 
   void HandleVideoWaited(MediaData::Type aType) override;
 
   void HandleNotWaited(const WaitForDataRejectValue& aRejection) override;
 
   ~AccurateSeekTask();
 
-  void RequestVideoData();
-
-  void RequestAudioData();
-
   nsresult DropAudioUpToSeekTarget(MediaData* aSample);
 
   nsresult DropVideoUpToSeekTarget(MediaData* aSample);
 
   void MaybeFinishSeek();
 
   void AdjustFastSeekIfNeeded(MediaData* aSample);
 
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -937,30 +937,46 @@ private:
   }
 
   void OnSeekResolved(media::TimeUnit) {
     mSeekRequest.Complete();
 
     // We must decode the first samples of active streams, so we can determine
     // the new stream time. So dispatch tasks to do that.
     if (!mTask->mDoneVideoSeeking) {
-      mTask->RequestVideoData();
+      RequestVideoData();
     }
     if (!mTask->mDoneAudioSeeking) {
-      mTask->RequestAudioData();
+      RequestAudioData();
     }
   }
 
   void OnSeekRejected(nsresult aResult) {
     mSeekRequest.Complete();
 
     MOZ_ASSERT(NS_FAILED(aResult), "Cancels should also disconnect mSeekRequest");
     mTask->RejectIfExist(aResult, __func__);
   }
 
+  void RequestAudioData()
+  {
+    MOZ_ASSERT(!mTask->mDoneAudioSeeking);
+    MOZ_ASSERT(!Reader()->IsRequestingAudioData());
+    MOZ_ASSERT(!Reader()->IsWaitingAudioData());
+    Reader()->RequestAudioData();
+  }
+
+  void RequestVideoData()
+  {
+    MOZ_ASSERT(!mTask->mDoneVideoSeeking);
+    MOZ_ASSERT(!Reader()->IsRequestingVideoData());
+    MOZ_ASSERT(!Reader()->IsWaitingVideoData());
+    Reader()->RequestVideoData(false, media::TimeUnit());
+  }
+
   void OnSeekTaskResolved(const SeekTaskResolveValue& aValue)
   {
     mSeekTaskRequest.Complete();
 
     if (aValue.mSeekedAudioData) {
       mMaster->Push(aValue.mSeekedAudioData);
       mMaster->mDecodedAudioEndTime = std::max(
         aValue.mSeekedAudioData->GetEndTime(), mMaster->mDecodedAudioEndTime);