Bug 1378085 p4 - override HandleAudioDecoded(); r?jwwang draft
authorKaku Kuo <kaku@mozilla.com>
Thu, 06 Jul 2017 11:45:07 +0800
changeset 604565 60c8a9666acfc2032da4a36e184e6ce5e5b9d2cc
parent 604564 4ad48d7f21617b137cb26a1d9ad031d3ae0553e1
child 604566 bff39df072a685569fddac86b922db24bb88fefa
push id67123
push userbmo:kaku@mozilla.com
push dateThu, 06 Jul 2017 03:57:15 +0000
reviewersjwwang
bugs1378085
milestone56.0a1
Bug 1378085 p4 - override HandleAudioDecoded(); r?jwwang MozReview-Commit-ID: BmxePYCesTF
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1051,25 +1051,16 @@ public:
   }
 
   void HandleAudioDecoded(AudioData* aAudio) override
   {
     MOZ_ASSERT(!mDoneAudioSeeking || !mDoneVideoSeeking,
                "Seek shouldn't be finished");
     MOZ_ASSERT(aAudio);
 
-    // Video-only seek doesn't reset audio decoder. There might be pending audio
-    // requests when AccurateSeekTask::Seek() begins. We will just store the
-    // data without checking |mDiscontinuity| or calling
-    // DropAudioUpToSeekTarget().
-    if (mSeekJob.mTarget->IsVideoOnly()) {
-      mMaster->PushAudio(aAudio);
-      return;
-    }
-
     AdjustFastSeekIfNeeded(aAudio);
 
     if (mSeekJob.mTarget->IsFast()) {
       // Non-precise seek; we can stop the seek at the first sample.
       mMaster->PushAudio(aAudio);
       mDoneAudioSeeking = true;
     } else {
       nsresult rv = DropAudioUpToSeekTarget(aAudio);
@@ -1782,16 +1773,29 @@ public:
       // We are discarding this video-only seek operation now, and we still need
       // to dispatch an event so that the UI can change in response to the end
       // of video-only seek.
       mMaster->mOnPlaybackEvent.Notify(MediaEventType::VideoOnlySeekCompleted);
     }
 
     AccurateSeekingState::Exit();
   }
+
+  void HandleAudioDecoded(AudioData* aAudio) override
+  {
+    MOZ_ASSERT(mDoneAudioSeeking && !mDoneVideoSeeking,
+               "Seek shouldn't be finished");
+    MOZ_ASSERT(aAudio);
+
+    // Video-only seek doesn't reset audio decoder. There might be pending audio
+    // requests when AccurateSeekTask::Seek() begins. We will just store the
+    // data without checking |mDiscontinuity| or calling
+    // DropAudioUpToSeekTarget().
+    mMaster->PushAudio(aAudio);
+  }
 };
 
 RefPtr<MediaDecoder::SeekPromise>
 MediaDecoderStateMachine::DormantState::HandleSeek(SeekTarget aTarget)
 {
   if (aTarget.IsNextFrame()) {
     // NextFrameSeekingState doesn't reset the decoder unlike
     // AccurateSeekingState. So we first must come out of dormant by seeking to