Bug 1325317. Part 2 - rename the function and fix comments. draft
authorJW Wang <jwwang@mozilla.com>
Thu, 22 Dec 2016 16:56:59 +0800
changeset 454474 210c791f7e4b956904035311452a47d2ec949b29
parent 454473 81b80b6909375028adde6961cca5b6b14c89f71d
child 454475 d760746364b9585128a74bf284246418eb024280
push id39939
push userjwwang@mozilla.com
push dateThu, 29 Dec 2016 11:52:26 +0000
bugs1325317
milestone53.0a1
Bug 1325317. Part 2 - rename the function and fix comments. MozReview-Commit-ID: 3GUkH5OpSmJ
dom/media/MediaDecoderStateMachine.cpp
dom/media/MediaDecoderStateMachine.h
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -427,17 +427,17 @@ public:
     auto t = mMaster->mMediaSink->IsStarted()
       ? mMaster->GetClock()
       : mMaster->GetMediaTime();
     mPendingSeek.mTarget.emplace(t, SeekTarget::Accurate);
     // SeekJob asserts |mTarget.IsValid() == !mPromise.IsEmpty()| so we
     // need to create the promise even it is not used at all.
     RefPtr<MediaDecoder::SeekPromise> x = mPendingSeek.mPromise.Ensure(__func__);
 
-    mMaster->Reset();
+    mMaster->ResetDecode();
     mMaster->StopMediaSink();
     mMaster->mReader->ReleaseResources();
   }
 
   void Exit() override
   {
     // mPendingSeek is either moved when exiting dormant or
     // should be rejected here before transition to SHUTDOWN.
@@ -967,19 +967,19 @@ private:
   }
 
   void DoSeek() override
   {
     mDoneAudioSeeking = !Info().HasAudio() || mSeekJob.mTarget->IsVideoOnly();
     mDoneVideoSeeking = !Info().HasVideo();
 
     if (mSeekJob.mTarget->IsVideoOnly()) {
-      mMaster->Reset(TrackInfo::kVideoTrack);
+      mMaster->ResetDecode(TrackInfo::kVideoTrack);
     } else {
-      mMaster->Reset();
+      mMaster->ResetDecode();
       mMaster->StopMediaSink();
     }
 
     DemuxerSeek();
   }
 
   int64_t CalculateNewCurrentTime() const override
   {
@@ -2267,17 +2267,17 @@ ShutdownState::Enter()
     master->StopPlayback();
   }
 
   master->mAudioDataRequest.DisconnectIfExists();
   master->mVideoDataRequest.DisconnectIfExists();
   master->mAudioWaitRequest.DisconnectIfExists();
   master->mVideoWaitRequest.DisconnectIfExists();
 
-  master->Reset();
+  master->ResetDecode();
   master->StopMediaSink();
   master->mMediaSink->Shutdown();
 
   // Prevent dangling pointers by disconnecting the listeners.
   master->mAudioQueueListener.Disconnect();
   master->mVideoQueueListener.Disconnect();
   master->mMetadataManager.Disconnect();
   master->mOnMediaNotSeekable.Disconnect();
@@ -3362,17 +3362,17 @@ MediaDecoderStateMachine::RunStateMachin
   MOZ_ASSERT(OnTaskQueue());
 
   mDelayedScheduler.Reset(); // Must happen on state machine task queue.
   mDispatchedStateMachine = false;
   mStateObj->Step();
 }
 
 void
-MediaDecoderStateMachine::Reset(TrackSet aTracks)
+MediaDecoderStateMachine::ResetDecode(TrackSet aTracks)
 {
   MOZ_ASSERT(OnTaskQueue());
   DECODER_LOG("MediaDecoderStateMachine::Reset");
 
   // We should be resetting because we're seeking, shutting down, or entering
   // dormant state. We could also be in the process of going dormant, and have
   // just switched to exiting dormant before we finished entering dormant,
   // hence the DECODING_NONE case below.
--- a/dom/media/MediaDecoderStateMachine.h
+++ b/dom/media/MediaDecoderStateMachine.h
@@ -319,20 +319,20 @@ private:
 
   // True if shutdown process has begun.
   bool IsShutdown() const;
 
   // Returns true if we're currently playing. The decoder monitor must
   // be held.
   bool IsPlaying() const;
 
-  // Resets all state related to decoding and playback, emptying all buffers
-  // and aborting all pending operations on the decode task queue.
-  void Reset(TrackSet aTracks = TrackSet(TrackInfo::kAudioTrack,
-                                         TrackInfo::kVideoTrack));
+  // Resets all states related to decoding and aborts all pending requests
+  // to the decoders.
+  void ResetDecode(TrackSet aTracks = TrackSet(TrackInfo::kAudioTrack,
+                                               TrackInfo::kVideoTrack));
 
 protected:
   virtual ~MediaDecoderStateMachine();
 
   void BufferedRangeUpdated();
 
   void ReaderSuspendedChanged();