Bug 1147435 - Fix SetDormant() handling in MediaOmxCommonDecoder r=cpearce
authorSotaro Ikeda <sikeda@mozilla.com>
Thu, 26 Mar 2015 20:57:42 -0700
changeset 266388 cc3988bc43b6a6d86a4a02df13eb4f06bb54dcee
parent 266387 96c8ca415e45befc351584a78c6b8d69882f6ed7
child 266389 3b30137b0f6aef6f8b17bae314a175f727a66e66
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1147435
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 1147435 - Fix SetDormant() handling in MediaOmxCommonDecoder r=cpearce
dom/media/omx/MediaOmxCommonDecoder.cpp
--- a/dom/media/omx/MediaOmxCommonDecoder.cpp
+++ b/dom/media/omx/MediaOmxCommonDecoder.cpp
@@ -96,17 +96,23 @@ void
 MediaOmxCommonDecoder::PauseStateMachine()
 {
   MOZ_ASSERT(NS_IsMainThread());
   GetReentrantMonitor().AssertCurrentThreadIn();
   DECODER_LOG(PR_LOG_DEBUG, ("%s", __PRETTY_FUNCTION__));
   if (!mDecoderStateMachine) {
     return;
   }
-  mDecoderStateMachine->SetDormant(true);
+  // enter dormant state
+  RefPtr<nsRunnable> event =
+    NS_NewRunnableMethodWithArg<bool>(
+      mDecoderStateMachine,
+      &MediaDecoderStateMachine::SetDormant,
+      true);
+  mDecoderStateMachine->TaskQueue()->Dispatch(event);
 }
 
 void
 MediaOmxCommonDecoder::ResumeStateMachine()
 {
   MOZ_ASSERT(NS_IsMainThread());
   ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
   DECODER_LOG(PR_LOG_DEBUG, ("%s current time %f", __PRETTY_FUNCTION__,
@@ -119,17 +125,23 @@ MediaOmxCommonDecoder::ResumeStateMachin
   mFallbackToStateMachine = true;
   mAudioOffloadPlayer = nullptr;
   int64_t timeUsecs = 0;
   SecondsToUsecs(mCurrentTime, timeUsecs);
   mRequestedSeekTarget = SeekTarget(timeUsecs, SeekTarget::Accurate);
 
   mNextState = mPlayState;
   ChangeState(PLAY_STATE_LOADING);
-  mDecoderStateMachine->SetDormant(false);
+  // exit dormant state
+  RefPtr<nsRunnable> event =
+    NS_NewRunnableMethodWithArg<bool>(
+      mDecoderStateMachine,
+      &MediaDecoderStateMachine::SetDormant,
+      false);
+  mDecoderStateMachine->TaskQueue()->Dispatch(event);
 }
 
 void
 MediaOmxCommonDecoder::AudioOffloadTearDown()
 {
   MOZ_ASSERT(NS_IsMainThread());
   DECODER_LOG(PR_LOG_DEBUG, ("%s", __PRETTY_FUNCTION__));