Bug 1136827 - Stop proxying DecodeError to the decode thread. r=mattwoodrow
☠☠ backed out by f0a4844f0ccd ☠ ☠
authorBobby Holley <bobbyholley@gmail.com>
Mon, 23 Mar 2015 16:15:54 -0700
changeset 264299 3eb419228c1f4d9206190262d86e07afd23e3c81
parent 264298 884d44a41ac74419b85b1500656de50928f7d482
child 264300 998f44ed19fb7228c6460d5910422843b8f4b04c
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1136827
milestone39.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 1136827 - Stop proxying DecodeError to the decode thread. r=mattwoodrow At this point, all the callers actually call it on the state machine thread, where it belongs.
dom/media/MediaDecoderStateMachine.cpp
dom/media/MediaDecoderStateMachine.h
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -926,23 +926,16 @@ MediaDecoderStateMachine::OnNotDecoded(M
     }
     default: {
       return;
     }
   }
 }
 
 void
-MediaDecoderStateMachine::AcquireMonitorAndInvokeDecodeError()
-{
-  ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
-  DecodeError();
-}
-
-void
 MediaDecoderStateMachine::MaybeFinishDecodeFirstFrame()
 {
   MOZ_ASSERT(OnStateMachineThread());
   AssertCurrentThreadInMonitor();
   if ((IsAudioDecoding() && AudioQueue().GetSize() == 0) ||
       (IsVideoDecoding() && VideoQueue().GetSize() == 0)) {
     return;
   }
@@ -2091,35 +2084,23 @@ bool MediaDecoderStateMachine::HasLowUnd
   return endOfDecodedData != INT64_MAX &&
          !buffered->Contains(static_cast<double>(endOfDecodedData) / USECS_PER_S,
                              static_cast<double>(std::min(endOfDecodedData + aUsecs, GetDuration())) / USECS_PER_S);
 }
 
 void
 MediaDecoderStateMachine::DecodeError()
 {
-  AssertCurrentThreadInMonitor();
+  MOZ_ASSERT(OnStateMachineThread());
+  ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
   if (mState == DECODER_STATE_SHUTDOWN) {
     // Already shutdown.
     return;
   }
 
-  // DecodeError should probably be redesigned so that it doesn't need to run
-  // on the Decode Task Queue, but this does the trick for now.
-  if (!OnDecodeThread()) {
-    RefPtr<nsIRunnable> task(
-      NS_NewRunnableMethod(this, &MediaDecoderStateMachine::AcquireMonitorAndInvokeDecodeError));
-    nsresult rv = DecodeTaskQueue()->Dispatch(task);
-
-    if (NS_FAILED(rv)) {
-      DECODER_WARN("Failed to dispatch AcquireMonitorAndInvokeDecodeError");
-    }
-    return;
-  }
-
   // Change state to shutdown before sending error report to MediaDecoder
   // and the HTMLMediaElement, so that our pipeline can start exiting
   // cleanly during the sync dispatch below.
   ScheduleStateMachine();
   SetState(DECODER_STATE_SHUTDOWN);
   DECODER_WARN("Decode error, changed state to SHUTDOWN due to error");
   mDecoder->GetReentrantMonitor().NotifyAll();
 
--- a/dom/media/MediaDecoderStateMachine.h
+++ b/dom/media/MediaDecoderStateMachine.h
@@ -405,19 +405,16 @@ public:
     ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
     WaitRequestRef(aRejection.mType).Complete();
   }
 
   // Resets all state related to decoding and playback, emptying all buffers
   // and aborting all pending operations on the decode task queue.
   void Reset();
 
-private:
-  void AcquireMonitorAndInvokeDecodeError();
-
 protected:
   virtual ~MediaDecoderStateMachine();
 
   void AssertCurrentThreadInMonitor() const { mDecoder->GetReentrantMonitor().AssertCurrentThreadIn(); }
 
   void SetState(State aState);
 
   // Inserts MediaData* samples into their respective MediaQueues.