Bug 1319992: P3. Remove no longer used seeking argument. r?jwwang draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 30 Nov 2016 01:42:50 +1100
changeset 448682 706a841f330d8f5f35a0a5ca8367533c1ebe2b1e
parent 448681 e5efa98589471a0b2c54a418e74fb88ad10775ab
child 448683 8ff184423e4403b515b9a19a8021ec13ff05addb
push id38406
push userbmo:jyavenard@mozilla.com
push dateMon, 12 Dec 2016 12:37:51 +0000
reviewersjwwang
bugs1319992
milestone53.0a1
Bug 1319992: P3. Remove no longer used seeking argument. r?jwwang MozReview-Commit-ID: 9Oc0SHX0Rw2
dom/media/AccurateSeekTask.cpp
dom/media/AccurateSeekTask.h
dom/media/MediaDecoderReader.h
dom/media/MediaDecoderReaderWrapper.cpp
dom/media/MediaDecoderReaderWrapper.h
dom/media/MediaDecoderStateMachine.cpp
dom/media/MediaFormatReader.cpp
dom/media/MediaFormatReader.h
dom/media/NextFrameSeekTask.cpp
dom/media/NextFrameSeekTask.h
dom/media/SeekTask.h
dom/media/android/AndroidMediaReader.cpp
dom/media/android/AndroidMediaReader.h
dom/media/directshow/DirectShowReader.cpp
dom/media/directshow/DirectShowReader.h
--- a/dom/media/AccurateSeekTask.cpp
+++ b/dom/media/AccurateSeekTask.cpp
@@ -253,24 +253,24 @@ AccurateSeekTask::HandleVideoWaited(Medi
 
 void
 AccurateSeekTask::HandleNotWaited(const WaitForDataRejectValue& aRejection)
 {
   AssertOwnerThread();
 }
 
 RefPtr<AccurateSeekTask::SeekTaskPromise>
-AccurateSeekTask::Seek(const media::TimeUnit& aDuration)
+AccurateSeekTask::Seek()
 {
   AssertOwnerThread();
 
   // Do the seek.
-  mSeekRequest.Begin(mReader->Seek(mTarget, aDuration)
-    ->Then(OwnerThread(), __func__, this,
-           &AccurateSeekTask::OnSeekResolved, &AccurateSeekTask::OnSeekRejected));
+  mSeekRequest.Begin(mReader->Seek(mTarget)->Then(
+    OwnerThread(), __func__, this, &AccurateSeekTask::OnSeekResolved,
+    &AccurateSeekTask::OnSeekRejected));
 
   return mSeekTaskPromise.Ensure(__func__);
 }
 
 void
 AccurateSeekTask::RequestAudioData()
 {
   AssertOwnerThread();
--- a/dom/media/AccurateSeekTask.h
+++ b/dom/media/AccurateSeekTask.h
@@ -20,17 +20,17 @@ public:
                    MediaDecoderReaderWrapper* aReader,
                    const SeekTarget& aTarget,
                    const MediaInfo& aInfo,
                    const media::TimeUnit& aEnd,
                    int64_t aCurrentMediaTime);
 
   void Discard() override;
 
-  RefPtr<SeekTaskPromise> Seek(const media::TimeUnit& aDuration) override;
+  RefPtr<SeekTaskPromise> Seek() override;
 
   bool NeedToResetMDSM() const override;
 
   int64_t CalculateNewCurrentTime() const override;
 
   void HandleAudioDecoded(MediaData* aAudio) override;
 
   void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart) override;
--- a/dom/media/MediaDecoderReader.h
+++ b/dom/media/MediaDecoderReader.h
@@ -146,20 +146,18 @@ public:
   // synchronous ReadMetadata() calls. Implementations may also
   // override AsyncReadMetadata to create a more proper async implementation.
   virtual RefPtr<MetadataPromise> AsyncReadMetadata();
 
   // Fills aInfo with the latest cached data required to present the media,
   // ReadUpdatedMetadata will always be called once ReadMetadata has succeeded.
   virtual void ReadUpdatedMetadata(MediaInfo* aInfo) {}
 
-  // Moves the decode head to aTime microseconds. aEndTime denotes the end
-  // time of the media in usecs. This is only needed for OggReader, and should
-  // probably be removed somehow.
-  virtual RefPtr<SeekPromise> Seek(const SeekTarget& aTarget, int64_t aEndTime) = 0;
+  // Moves the decode head to aTime microseconds.
+  virtual RefPtr<SeekPromise> Seek(const SeekTarget& aTarget) = 0;
 
   virtual void SetCDMProxy(CDMProxy* aProxy) {}
 
   // Tell the reader that the data decoded are not for direct playback, so it
   // can accept more files, in particular those which have more channels than
   // available in the audio output.
   void SetIgnoreAudioOutputFormat()
   {
--- a/dom/media/MediaDecoderReaderWrapper.cpp
+++ b/dom/media/MediaDecoderReaderWrapper.cpp
@@ -116,26 +116,25 @@ MediaDecoderReaderWrapper::IsWaitingAudi
 bool
 MediaDecoderReaderWrapper::IsWaitingVideoData() const
 {
   MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
   return mVideoWaitRequest.Exists();
 }
 
 RefPtr<MediaDecoderReader::SeekPromise>
-MediaDecoderReaderWrapper::Seek(const SeekTarget& aTarget,
-                                const media::TimeUnit& aEndTime)
+MediaDecoderReaderWrapper::Seek(const SeekTarget& aTarget)
 {
   MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
   SeekTarget adjustedTarget = aTarget;
   adjustedTarget.SetTime(adjustedTarget.GetTime() + StartTime());
-  return InvokeAsync<SeekTarget&&, int64_t>(
+  return InvokeAsync<SeekTarget&&>(
            mReader->OwnerThread(), mReader.get(), __func__,
            &MediaDecoderReader::Seek,
-           Move(adjustedTarget), aEndTime.ToMicroseconds());
+           Move(adjustedTarget));
 }
 
 void
 MediaDecoderReaderWrapper::WaitForData(MediaData::Type aType)
 {
   MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
 
   auto p = InvokeAsync(mReader->OwnerThread(), mReader.get(), __func__,
--- a/dom/media/MediaDecoderReaderWrapper.h
+++ b/dom/media/MediaDecoderReaderWrapper.h
@@ -62,18 +62,17 @@ public:
   // NOTE: please set callbacks before invoking WaitForData()!
   void WaitForData(MediaData::Type aType);
 
   bool IsRequestingAudioData() const;
   bool IsRequestingVideoData() const;
   bool IsWaitingAudioData() const;
   bool IsWaitingVideoData() const;
 
-  RefPtr<SeekPromise> Seek(const SeekTarget& aTarget,
-                           const media::TimeUnit& aEndTime);
+  RefPtr<SeekPromise> Seek(const SeekTarget& aTarget);
   RefPtr<ShutdownPromise> Shutdown();
 
   void ReleaseResources();
   void ResetDecode(TrackSet aTracks);
 
   nsresult Init() { return mReader->Init(); }
   bool IsWaitForDataSupported() const { return mReader->IsWaitForDataSupported(); }
   bool IsAsync() const { return mReader->IsAsync(); }
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -804,17 +804,17 @@ public:
       if (mSeekJob.mTarget.IsVideoOnly()) {
         mMaster->Reset(TrackInfo::kVideoTrack);
       } else {
         mMaster->Reset();
       }
     }
 
     // Do the seek.
-    mSeekTaskRequest.Begin(mSeekTask->Seek(mMaster->Duration())
+    mSeekTaskRequest.Begin(mSeekTask->Seek()
       ->Then(OwnerThread(), __func__,
              [this] (const SeekTaskResolveValue& aValue) {
                OnSeekTaskResolved(aValue);
              },
              [this] (const SeekTaskRejectValue& aValue) {
                OnSeekTaskRejected(aValue);
              }));
 
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -2259,17 +2259,17 @@ MediaFormatReader::OnVideoSkipFailed(Med
       break;
     default:
       NotifyError(TrackType::kVideoTrack, aFailure.mFailure);
       break;
   }
 }
 
 RefPtr<MediaDecoderReader::SeekPromise>
-MediaFormatReader::Seek(const SeekTarget& aTarget, int64_t aUnused)
+MediaFormatReader::Seek(const SeekTarget& aTarget)
 {
   MOZ_ASSERT(OnTaskQueue());
 
   LOG("aTarget=(%lld)", aTarget.GetTime().ToMicroseconds());
 
   MOZ_DIAGNOSTIC_ASSERT(mSeekPromise.IsEmpty());
   MOZ_DIAGNOSTIC_ASSERT(!mVideo.HasPromise());
   MOZ_DIAGNOSTIC_ASSERT(aTarget.IsVideoOnly() || !mAudio.HasPromise());
--- a/dom/media/MediaFormatReader.h
+++ b/dom/media/MediaFormatReader.h
@@ -41,18 +41,17 @@ public:
   RequestVideoData(bool aSkipToNextKeyframe, int64_t aTimeThreshold) override;
 
   RefPtr<MediaDataPromise> RequestAudioData() override;
 
   RefPtr<MetadataPromise> AsyncReadMetadata() override;
 
   void ReadUpdatedMetadata(MediaInfo* aInfo) override;
 
-  RefPtr<SeekPromise>
-  Seek(const SeekTarget& aTarget, int64_t aUnused) override;
+  RefPtr<SeekPromise> Seek(const SeekTarget& aTarget) override;
 
 protected:
   void NotifyDataArrived() override;
 
 public:
   bool ForceZeroStartTime() const override;
 
   // For Media Resource Management
--- a/dom/media/NextFrameSeekTask.cpp
+++ b/dom/media/NextFrameSeekTask.cpp
@@ -233,17 +233,17 @@ DiscardFrames(MediaQueue<MediaData>& aQu
       RefPtr<MediaData> releaseMe = aQueue.PopFront();
       continue;
     }
     break;
   }
 }
 
 RefPtr<NextFrameSeekTask::SeekTaskPromise>
-NextFrameSeekTask::Seek(const media::TimeUnit&)
+NextFrameSeekTask::Seek()
 {
   AssertOwnerThread();
 
   auto currentTime = mCurrentTime;
   DiscardFrames(mVideoQueue, [currentTime] (int64_t aSampleTime) {
     return aSampleTime <= currentTime;
   });
 
--- a/dom/media/NextFrameSeekTask.h
+++ b/dom/media/NextFrameSeekTask.h
@@ -31,17 +31,17 @@ public:
                    const MediaInfo& aInfo,
                    const media::TimeUnit& aDuration,
                    int64_t aCurrentTime,
                    MediaQueue<MediaData>& aAudioQueue,
                    MediaQueue<MediaData>& aVideoQueue);
 
   void Discard() override;
 
-  RefPtr<SeekTaskPromise> Seek(const media::TimeUnit& aDuration) override;
+  RefPtr<SeekTaskPromise> Seek() override;
 
   bool NeedToResetMDSM() const override;
 
   int64_t CalculateNewCurrentTime() const override;
 
   void HandleAudioDecoded(MediaData* aAudio) override;
 
   void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart) override;
--- a/dom/media/SeekTask.h
+++ b/dom/media/SeekTask.h
@@ -49,17 +49,17 @@ class SeekTask {
 public:
   static const bool IsExclusive = true;
 
   using SeekTaskPromise =
     MozPromise<SeekTaskResolveValue, SeekTaskRejectValue, IsExclusive>;
 
   virtual void Discard() = 0;
 
-  virtual RefPtr<SeekTaskPromise> Seek(const media::TimeUnit& aDuration) = 0;
+  virtual RefPtr<SeekTaskPromise> Seek() = 0;
 
   virtual bool NeedToResetMDSM() const = 0;
 
   virtual int64_t CalculateNewCurrentTime() const = 0;
 
   virtual void HandleAudioDecoded(MediaData* aAudio) = 0;
 
   virtual void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart) = 0;
--- a/dom/media/android/AndroidMediaReader.cpp
+++ b/dom/media/android/AndroidMediaReader.cpp
@@ -309,17 +309,17 @@ bool AndroidMediaReader::DecodeAudioData
                               frames,
                               source.mAudioChannels,
                               MPCopy(static_cast<uint8_t *>(source.mData),
                                      source.mSize,
                                      source.mAudioChannels));
 }
 
 RefPtr<MediaDecoderReader::SeekPromise>
-AndroidMediaReader::Seek(const SeekTarget& aTarget, int64_t aEndTime)
+AndroidMediaReader::Seek(const SeekTarget& aTarget)
 {
   MOZ_ASSERT(OnTaskQueue());
 
   RefPtr<SeekPromise> p = mSeekPromise.Ensure(__func__);
   if (mHasAudio && mHasVideo) {
     // The decoder seeks/demuxes audio and video streams separately. So if
     // we seek both audio and video to aTarget, the audio stream can typically
     // seek closer to the seek target, since typically every audio block is
--- a/dom/media/android/AndroidMediaReader.h
+++ b/dom/media/android/AndroidMediaReader.h
@@ -43,17 +43,17 @@ public:
 
   nsresult ResetDecode(TrackSet aTracks = TrackSet(TrackInfo::kAudioTrack,
                                                    TrackInfo::kVideoTrack)) override;
 
   bool DecodeAudioData() override;
   bool DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) override;
 
   nsresult ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) override;
-  RefPtr<SeekPromise> Seek(const SeekTarget& aTarget, int64_t aEndTime) override;
+  RefPtr<SeekPromise> Seek(const SeekTarget& aTarget) override;
 
   RefPtr<ShutdownPromise> Shutdown() override;
 
   class ImageBufferCallback : public MPAPI::BufferCallback {
     typedef mozilla::layers::Image Image;
 
   public:
     ImageBufferCallback(mozilla::layers::ImageContainer *aImageContainer);
--- a/dom/media/directshow/DirectShowReader.cpp
+++ b/dom/media/directshow/DirectShowReader.cpp
@@ -315,17 +315,17 @@ bool
 DirectShowReader::DecodeVideoFrame(bool &aKeyframeSkip,
                                    int64_t aTimeThreshold)
 {
   MOZ_ASSERT(OnTaskQueue());
   return false;
 }
 
 RefPtr<MediaDecoderReader::SeekPromise>
-DirectShowReader::Seek(const SeekTarget& aTarget, int64_t aEndTime)
+DirectShowReader::Seek(const SeekTarget& aTarget)
 {
   nsresult res = SeekInternal(aTarget.GetTime().ToMicroseconds());
   if (NS_FAILED(res)) {
     return SeekPromise::CreateAndReject(res, __func__);
   } else {
     return SeekPromise::CreateAndResolve(aTarget.GetTime(), __func__);
   }
 }
--- a/dom/media/directshow/DirectShowReader.h
+++ b/dom/media/directshow/DirectShowReader.h
@@ -52,18 +52,17 @@ public:
 
   bool DecodeAudioData() override;
   bool DecodeVideoFrame(bool &aKeyframeSkip,
                         int64_t aTimeThreshold) override;
 
   nsresult ReadMetadata(MediaInfo* aInfo,
                         MetadataTags** aTags) override;
 
-  RefPtr<SeekPromise>
-  Seek(const SeekTarget& aTarget, int64_t aEndTime) override;
+  RefPtr<SeekPromise> Seek(const SeekTarget& aTarget) override;
 
   static const GUID CLSID_MPEG_LAYER_3_DECODER_FILTER;
 
 private:
   // Notifies the filter graph that playback is complete. aStatus is
   // the code to send to the filter graph. Always returns false, so
   // that we can just "return Finish()" from DecodeAudioData().
   bool Finish(HRESULT aStatus);