Bug 1329897. Part 4 - inline Ensure{Audio,Video}DecodeTaskQueued for DispatchDecodeTasksIfNeeded is the only caller. r=kaku
authorJW Wang <jwwang@mozilla.com>
Mon, 09 Jan 2017 20:37:06 +0800
changeset 328840 fca115e560c8c6b40948da510b8e938745a464bf
parent 328839 f914c3a64f8223d60061039f42fec2e565105a87
child 328841 d1d89a3a187aa24845db5886cf0bc89747e2db5b
push id31190
push usercbook@mozilla.com
push dateWed, 11 Jan 2017 15:21:29 +0000
treeherdermozilla-central@5493551203ed [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskaku
bugs1329897
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1329897. Part 4 - inline Ensure{Audio,Video}DecodeTaskQueued for DispatchDecodeTasksIfNeeded is the only caller. r=kaku MozReview-Commit-ID: CrldEKxY9Qg
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1688,18 +1688,16 @@ public:
       mMaster->mVideoDecodeSuspended = true;
       mMaster->mOnPlaybackEvent.Notify(MediaEventType::EnterVideoSuspend);
       Reader()->SetVideoBlankDecode(true);
     }
   }
 
 private:
   void DispatchDecodeTasksIfNeeded();
-  void EnsureAudioDecodeTaskQueued();
-  void EnsureVideoDecodeTaskQueued();
 
   TimeStamp mBufferingStart;
 
   // The maximum number of second we spend buffering when we are short on
   // unbuffered data.
   const uint32_t mBufferingWait = 15;
 };
 
@@ -2243,48 +2241,28 @@ SeekingState::SeekCompleted()
   SetState<DecodingState>();
 }
 
 void
 MediaDecoderStateMachine::
 BufferingState::DispatchDecodeTasksIfNeeded()
 {
   if (mMaster->IsAudioDecoding() &&
-      !mMaster->HaveEnoughDecodedAudio()) {
-    EnsureAudioDecodeTaskQueued();
+      !mMaster->HaveEnoughDecodedAudio() &&
+      !mMaster->IsRequestingAudioData() &&
+      !mMaster->IsWaitingAudioData()) {
+    mMaster->RequestAudioData();
   }
 
   if (mMaster->IsVideoDecoding() &&
-      !mMaster->HaveEnoughDecodedVideo()) {
-    EnsureVideoDecodeTaskQueued();
-  }
-}
-
-void
-MediaDecoderStateMachine::
-BufferingState::EnsureAudioDecodeTaskQueued()
-{
-  if (!mMaster->IsAudioDecoding() ||
-      mMaster->IsRequestingAudioData() ||
-      mMaster->IsWaitingAudioData()) {
-    return;
+      !mMaster->HaveEnoughDecodedVideo() &&
+      !mMaster->IsRequestingVideoData() &&
+      !mMaster->IsWaitingVideoData()) {
+    mMaster->RequestVideoData(false, media::TimeUnit());
   }
-  mMaster->RequestAudioData();
-}
-
-void
-MediaDecoderStateMachine::
-BufferingState::EnsureVideoDecodeTaskQueued()
-{
-  if (!mMaster->IsVideoDecoding() ||
-      mMaster->IsRequestingVideoData() ||
-      mMaster->IsWaitingVideoData()) {
-    return;
-  }
-  mMaster->RequestVideoData(false, media::TimeUnit());
 }
 
 void
 MediaDecoderStateMachine::
 BufferingState::Step()
 {
   TimeStamp now = TimeStamp::Now();
   MOZ_ASSERT(!mBufferingStart.IsNull(), "Must know buffering start time.");