Bug 1294320 - Remove MediaDecoderStateMachine::IsVideoDecodeSuspended() draft
authorJW Wang <jwwang@mozilla.com>
Thu, 11 Aug 2016 11:32:14 +0800
changeset 399441 6937ea9d7058befbce907221f610533661701bc6
parent 399440 3220542018f6dc8e4f595c14ffb7d3ba520c6ec7
child 527933 c4d76e82f5515cacc1fc6a4efc2105933c1a0f16
push id25838
push userjwwang@mozilla.com
push dateThu, 11 Aug 2016 03:34:06 +0000
bugs1294320
milestone51.0a1
Bug 1294320 - Remove MediaDecoderStateMachine::IsVideoDecodeSuspended() MozReview-Commit-ID: 9iTzmMhw686
dom/media/MediaDecoderStateMachine.cpp
dom/media/MediaDecoderStateMachine.h
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -466,20 +466,16 @@ bool MediaDecoderStateMachine::HaveEnoug
   // at which the DecodedStream is playing.
   return true;
 }
 
 bool MediaDecoderStateMachine::HaveEnoughDecodedVideo()
 {
   MOZ_ASSERT(OnTaskQueue());
 
-  if (IsVideoDecodeSuspended()) {
-    return true;
-  }
-
   if (VideoQueue().GetSize() == 0) {
     return false;
   }
 
   if (VideoQueue().GetSize() - 1 < GetAmpleVideoFrames() * mPlaybackRate) {
     return false;
   }
 
@@ -1799,23 +1795,16 @@ MediaDecoderStateMachine::EnsureVideoDec
   SAMPLE_LOG("EnsureVideoDecodeTaskQueued isDecoding=%d status=%s",
              IsVideoDecoding(), VideoRequestStatus());
 
   if (mState != DECODER_STATE_DECODING &&
       mState != DECODER_STATE_BUFFERING) {
     return NS_OK;
   }
 
-  if (IsVideoDecodeSuspended() && !IsDecodingFirstFrame()) {
-    // The element is invisible and background videos should be suspended.
-    // If the first frame has already been decoded, don't request anymore video
-    // frames.
-    return NS_OK;
-  }
-
   if (!IsVideoDecoding() || mReader->IsRequestingVideoData() ||
       mReader->IsWaitingVideoData()) {
     return NS_OK;
   }
 
   RequestVideoData();
   return NS_OK;
 }
@@ -2631,22 +2620,16 @@ bool MediaDecoderStateMachine::OnTaskQue
 }
 
 bool MediaDecoderStateMachine::IsStateMachineScheduled() const
 {
   MOZ_ASSERT(OnTaskQueue());
   return mDispatchedStateMachine || mDelayedScheduler.IsScheduled();
 }
 
-bool MediaDecoderStateMachine::IsVideoDecodeSuspended() const
-{
-  MOZ_ASSERT(OnTaskQueue());
-  return mIsReaderSuspended;
-}
-
 void
 MediaDecoderStateMachine::LogicalPlaybackRateChanged()
 {
   MOZ_ASSERT(OnTaskQueue());
 
   if (mLogicalPlaybackRate == 0) {
     // This case is handled in MediaDecoder by pausing playback.
     return;
--- a/dom/media/MediaDecoderStateMachine.h
+++ b/dom/media/MediaDecoderStateMachine.h
@@ -591,20 +591,16 @@ protected:
 
   bool IsStateMachineScheduled() const;
 
   // Returns true if we're not playing and the decode thread has filled its
   // decode buffers and is waiting. We can shut the decode thread down in this
   // case as it may not be needed again.
   bool IsPausedAndDecoderWaiting();
 
-  // Returns true if the video decoding is suspended because the element is not
-  // visible
-  bool IsVideoDecodeSuspended() const;
-
   // These return true if the respective stream's decode has not yet reached
   // the end of stream.
   bool IsAudioDecoding();
   bool IsVideoDecoding();
 
 private:
   // Resolved by the MediaSink to signal that all audio/video outstanding
   // work is complete and identify which part(a/v) of the sink is shutting down.