Bug 984816: RTSP play/pause deadlock issue. 1. Release the monitor when access mReader. 2. Reverse the order in RtspOmxReader::SetIdle(). r=cpearce
authorBenjamin Chen <bechen@mozilla.com>
Mon, 31 Mar 2014 10:18:01 +0800
changeset 188299 d0080077a537e45b746060d917c2c4100867bbeb
parent 188298 8de70e6d49fd0c8ce27311e198c05de0e61d8d0d
child 188300 c0949074997ba8dc229fbf871cdb7c8491b47ff2
push idunknown
push userunknown
push dateunknown
reviewerscpearce
bugs984816
milestone31.0a1
Bug 984816: RTSP play/pause deadlock issue. 1. Release the monitor when access mReader. 2. Reverse the order in RtspOmxReader::SetIdle(). r=cpearce
content/media/MediaDecoderStateMachine.cpp
content/media/omx/RtspOmxReader.cpp
--- a/content/media/MediaDecoderStateMachine.cpp
+++ b/content/media/MediaDecoderStateMachine.cpp
@@ -1500,17 +1500,20 @@ void
 MediaDecoderStateMachine::EnsureActive()
 {
   AssertCurrentThreadInMonitor();
   MOZ_ASSERT(OnDecodeThread());
   if (!mIsReaderIdle) {
     return;
   }
   mIsReaderIdle = false;
-  SetReaderActive();
+  {
+    ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
+    SetReaderActive();
+  }
 }
 
 void
 MediaDecoderStateMachine::SetReaderIdle()
 {
   DECODER_LOG(PR_LOG_DEBUG, ("%p SetReaderIdle()", mDecoder.get()));
   MOZ_ASSERT(OnDecodeThread());
   mReader->SetIdle();
--- a/content/media/omx/RtspOmxReader.cpp
+++ b/content/media/omx/RtspOmxReader.cpp
@@ -307,27 +307,27 @@ RtspOmxReader::ReadMetadata(MediaInfo* a
   NS_ENSURE_SUCCESS(rv, rv);
 
   SetActive();
 
   return NS_OK;
 }
 
 void RtspOmxReader::SetIdle() {
+  // Call parent class to set OMXCodec idle.
+  MediaOmxReader::SetIdle();
+
   // Need to pause RTSP streaming OMXCodec decoding.
   if (mRtspResource) {
     nsIStreamingProtocolController* controller =
         mRtspResource->GetMediaStreamController();
     if (controller) {
       controller->Pause();
     }
   }
-
-  // Call parent class to set OMXCodec idle.
-  MediaOmxReader::SetIdle();
 }
 
 void RtspOmxReader::SetActive() {
   // Need to start RTSP streaming OMXCodec decoding.
   if (mRtspResource) {
     nsIStreamingProtocolController* controller =
         mRtspResource->GetMediaStreamController();
     if (controller) {