Bug 1321140 - don't clamp up the SeekTarget again in the AccurateSeekTask's constructor; r=jwwang
authorKaku Kuo <kaku@mozilla.com>
Tue, 29 Nov 2016 17:59:22 +0800
changeset 324940 8f7f94968f7bfc57e99c4cb1615a8cb79cd555f8
parent 324939 ffd7e71624b515b17653a5378d9572afa7aa8759
child 324941 64cbe9e0ac0a5018e2fada3f1ca8e099c930c632
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersjwwang
bugs1321140
milestone53.0a1
Bug 1321140 - don't clamp up the SeekTarget again in the AccurateSeekTask's constructor; r=jwwang MozReview-Commit-ID: KQro2Sk1dRg
dom/media/AccurateSeekTask.cpp
dom/media/MediaDecoderStateMachine.cpp
dom/media/SeekTask.cpp
dom/media/SeekTask.h
--- a/dom/media/AccurateSeekTask.cpp
+++ b/dom/media/AccurateSeekTask.cpp
@@ -35,20 +35,16 @@ AccurateSeekTask::AccurateSeekTask(const
                                    int64_t aCurrentMediaTime)
   : SeekTask(aDecoderID, aThread, aReader, aTarget)
   , mCurrentTimeBeforeSeek(media::TimeUnit::FromMicroseconds(aCurrentMediaTime))
   , mAudioRate(aInfo.mAudio.mRate)
   , mDoneAudioSeeking(!aInfo.HasAudio() || aTarget.IsVideoOnly())
   , mDoneVideoSeeking(!aInfo.HasVideo())
 {
   AssertOwnerThread();
-
-  // Bound the seek time to be inside the media range.
-  NS_ASSERTION(aEnd.ToMicroseconds() != -1, "Should know end time by now");
-  mTarget.SetTime(std::max(media::TimeUnit(), std::min(mTarget.GetTime(), aEnd)));
 }
 
 AccurateSeekTask::~AccurateSeekTask()
 {
   AssertOwnerThread();
   MOZ_ASSERT(mIsDiscarded);
 }
 
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -786,22 +786,17 @@ public:
       MOZ_DIAGNOSTIC_ASSERT(false, "Cannot handle this seek task.");
     }
 
     // Don't stop playback for a video-only seek since audio is playing.
     if (!mSeekJob.mTarget.IsVideoOnly()) {
       mMaster->StopPlayback();
     }
 
-    // mSeekJob.mTarget.mTime might be different from
-    // mSeekTask->GetSeekTarget().mTime because the seek task might clamp the
-    // seek target to [0, duration]. We want to update the playback position to
-    // the clamped value.
-    mMaster->UpdatePlaybackPositionInternal(
-      mSeekTask->GetSeekTarget().GetTime().ToMicroseconds());
+    mMaster->UpdatePlaybackPositionInternal(mSeekJob.mTarget.GetTime().ToMicroseconds());
 
     if (mVisibility == EventVisibility::Observable) {
       mMaster->mOnPlaybackEvent.Notify(MediaEventType::SeekStarted);
       // We want dormant actions to be transparent to the user.
       // So we only notify the change when the seek request is from the user.
       mMaster->UpdateNextFrameStatus(MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_SEEKING);
     }
 
--- a/dom/media/SeekTask.cpp
+++ b/dom/media/SeekTask.cpp
@@ -66,16 +66,9 @@ SeekTask::AssertOwnerThread() const
 
 AbstractThread*
 SeekTask::OwnerThread() const
 {
   AssertOwnerThread();
   return mOwnerThread;
 }
 
-const SeekTarget&
-SeekTask::GetSeekTarget()
-{
-  AssertOwnerThread();
-  return mTarget;
-}
-
 } // namespace mozilla
--- a/dom/media/SeekTask.h
+++ b/dom/media/SeekTask.h
@@ -55,18 +55,16 @@ public:
   virtual void Discard() = 0;
 
   virtual RefPtr<SeekTaskPromise> Seek(const media::TimeUnit& aDuration) = 0;
 
   virtual bool NeedToResetMDSM() const = 0;
 
   virtual int64_t CalculateNewCurrentTime() const = 0;
 
-  const SeekTarget& GetSeekTarget();
-
   virtual void HandleAudioDecoded(MediaData* aAudio) = 0;
 
   virtual void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart) = 0;
 
   virtual void HandleNotDecoded(MediaData::Type aType, const MediaResult& aError) = 0;
 
   virtual void HandleAudioWaited(MediaData::Type aType) = 0;