Backed out changeset aa529bac2a92 (bug 996465)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Fri, 11 Jul 2014 09:54:24 +0200
changeset 215485 b22e5c7852b7f868563af8f148030a55a89d7f9c
parent 215484 ce7ec235a8b88578342ecd3d31a9a813291cc5ff
child 215486 b9457b4aaf3858000eeb7c7c978352006d4f59ec
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs996465
milestone33.0a1
backs outaa529bac2a92d02a8282691434bd65d81bc5707e
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
Backed out changeset aa529bac2a92 (bug 996465)
content/media/MediaDecoderStateMachine.cpp
content/media/MediaDecoderStateMachineScheduler.cpp
content/media/MediaDecoderStateMachineScheduler.h
--- a/content/media/MediaDecoderStateMachine.cpp
+++ b/content/media/MediaDecoderStateMachine.cpp
@@ -2157,31 +2157,27 @@ MediaDecoderStateMachine::SeekCompleted(
   UpdatePlaybackPositionInternal(newCurrentTime);
   if (mDecoder->GetDecodedStream()) {
     SetSyncPointForMediaStream();
   }
 
   // Try to decode another frame to detect if we're at the end...
   DECODER_LOG(PR_LOG_DEBUG, "Seek completed, mCurrentFrameTime=%lld", mCurrentFrameTime);
 
-  // Prevent changes in playback position before 'seeked' is fired for we
-  // expect currentTime equals seek target in 'seeked' callback.
-  mScheduler->FreezeScheduling();
   {
     ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
     NS_DispatchToMainThread(stopEvent, NS_DISPATCH_SYNC);
   }
 
   // Reset quick buffering status. This ensures that if we began the
   // seek while quick-buffering, we won't bypass quick buffering mode
   // if we need to buffer after the seek.
   mQuickBuffering = false;
 
   ScheduleStateMachine();
-  mScheduler->ThawScheduling();
 }
 
 // Runnable to dispose of the decoder and state machine on the main thread.
 class nsDecoderDisposeEvent : public nsRunnable {
 public:
   nsDecoderDisposeEvent(already_AddRefed<MediaDecoder> aDecoder,
                         already_AddRefed<MediaDecoderStateMachine> aStateMachine)
     : mDecoder(aDecoder), mStateMachine(aStateMachine) {}
--- a/content/media/MediaDecoderStateMachineScheduler.cpp
+++ b/content/media/MediaDecoderStateMachineScheduler.cpp
@@ -89,25 +89,18 @@ MediaDecoderStateMachineScheduler::Init(
   return NS_OK;
 }
 
 nsresult
 MediaDecoderStateMachineScheduler::Schedule(int64_t aUsecs)
 {
   mMonitor.AssertCurrentThreadIn();
 
-  switch(mState) {
-  case SCHEDULER_STATE_SHUTDOWN:
+  if (mState == SCHEDULER_STATE_SHUTDOWN) {
     return NS_ERROR_FAILURE;
-  case SCHEDULER_STATE_FROZEN:
-    mState = SCHEDULER_STATE_FROZEN_WITH_PENDING_TASK;
-  case SCHEDULER_STATE_FROZEN_WITH_PENDING_TASK:
-    return NS_OK;
-  case SCHEDULER_STATE_NONE:
-    break;
   }
 
   aUsecs = std::max<int64_t>(aUsecs, 0);
 
   TimeStamp timeout = TimeStamp::Now() + UsecsToDuration(aUsecs);
   if (!mTimeout.IsNull() && timeout >= mTimeout) {
     // We've already scheduled a timer set to expire at or before this time,
     // or have an event dispatched to run the state machine.
@@ -166,19 +159,16 @@ MediaDecoderStateMachineScheduler::Timeo
 
   return rv;
 }
 
 void
 MediaDecoderStateMachineScheduler::ScheduleAndShutdown()
 {
   mMonitor.AssertCurrentThreadIn();
-  if (IsFrozen()) {
-    ThawScheduling();
-  }
   // Schedule next cycle to handle SHUTDOWN in state machine thread.
   Schedule();
   // This must be set after calling Schedule()
   // which does nothing in shutdown state.
   mState = SCHEDULER_STATE_SHUTDOWN;
 }
 
 bool
@@ -199,38 +189,9 @@ MediaDecoderStateMachineScheduler::IsSch
 void
 MediaDecoderStateMachineScheduler::ResetTimer()
 {
   mMonitor.AssertCurrentThreadIn();
   mTimer->Cancel();
   mTimeout = TimeStamp();
 }
 
-void MediaDecoderStateMachineScheduler::FreezeScheduling()
-{
-  mMonitor.AssertCurrentThreadIn();
-  if (mState == SCHEDULER_STATE_SHUTDOWN) {
-    return;
-  }
-  MOZ_ASSERT(mState == SCHEDULER_STATE_NONE);
-  mState = !IsScheduled() ? SCHEDULER_STATE_FROZEN :
-                            SCHEDULER_STATE_FROZEN_WITH_PENDING_TASK;
-  // Nullify pending timer task if any.
-  ++mTimerId;
-  mTimeout = TimeStamp();
-}
-
-void MediaDecoderStateMachineScheduler::ThawScheduling()
-{
-  mMonitor.AssertCurrentThreadIn();
-  if (mState == SCHEDULER_STATE_SHUTDOWN) {
-    return;
-  }
-  // We should be in frozen state and no pending timer task.
-  MOZ_ASSERT(IsFrozen() && !IsScheduled());
-  bool pendingTask = mState == SCHEDULER_STATE_FROZEN_WITH_PENDING_TASK;
-  mState = SCHEDULER_STATE_NONE;
-  if (pendingTask) {
-    Schedule();
-  }
-}
-
 } // namespace mozilla
--- a/content/media/MediaDecoderStateMachineScheduler.h
+++ b/content/media/MediaDecoderStateMachineScheduler.h
@@ -16,48 +16,39 @@ class nsIEventTarget;
 
 namespace mozilla {
 
 class ReentrantMonitor;
 
 class MediaDecoderStateMachineScheduler {
   enum State {
     SCHEDULER_STATE_NONE,
-    SCHEDULER_STATE_FROZEN,
-    SCHEDULER_STATE_FROZEN_WITH_PENDING_TASK,
     SCHEDULER_STATE_SHUTDOWN
   };
 public:
   MediaDecoderStateMachineScheduler(ReentrantMonitor& aMonitor,
                                     nsresult (*aTimeoutCallback)(void*),
                                     void* aClosure, bool aRealTime);
   ~MediaDecoderStateMachineScheduler();
   nsresult Init();
   nsresult Schedule(int64_t aUsecs = 0);
   void ScheduleAndShutdown();
   nsresult TimeoutExpired(int aTimerId);
-  void FreezeScheduling();
-  void ThawScheduling();
 
   bool OnStateMachineThread() const;
   bool IsScheduled() const;
 
   bool IsRealTime() const {
     return mRealTime;
   }
 
   nsIEventTarget* GetStateMachineThread() const {
     return mEventTarget;
   }
 
-  bool IsFrozen() const {
-    return mState == SCHEDULER_STATE_FROZEN ||
-           mState == SCHEDULER_STATE_FROZEN_WITH_PENDING_TASK;
-  }
-
 private:
   void ResetTimer();
 
   // Callback function provided by MediaDecoderStateMachine to run
   // state machine cycles.
   nsresult (*const mTimeoutCallback)(void*);
   // Since StateMachineScheduler will never outlive the state machine,
   // it is safe to keep a raw pointer only to avoid reference cycles.