Bug 1326372 - P1. Backed out changeset 4ea0f7d805d9 bug 1319995-P4 - r=jya a=abillings
authorGerald Squelart <gsquelart@squelart.com>
Tue, 14 Feb 2017 12:30:17 +1100
changeset 376182 0dab61b1573fd15a2a6fc80cd773cd1dc5cd0915
parent 376181 df61d1e2b7e998beaa853369dff70d8fb7d7f7d2
child 376183 b58ee06413e1a365c40f90ab1d1ca7d5db1916c0
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya, abillings
bugs1326372, 1319995
milestone53.0a2
Bug 1326372 - P1. Backed out changeset 4ea0f7d805d9 bug 1319995-P4 - r=jya a=abillings Original commit description: "Use Mutex in place of Monitor"
dom/media/MediaFormatReader.cpp
dom/media/MediaFormatReader.h
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -15,16 +15,17 @@
 #include "VideoFrameContainer.h"
 #include "mozilla/dom/HTMLMediaElement.h"
 #include "mozilla/layers/ShadowLayers.h"
 #include "mozilla/AbstractThread.h"
 #include "mozilla/CDMProxy.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Telemetry.h"
+#include "mozilla/Mutex.h"
 #include "mozilla/SharedThreadPool.h"
 #include "mozilla/SyncRunnable.h"
 #include "nsContentUtils.h"
 #include "nsPrintfCString.h"
 #include "nsSize.h"
 
 #include <algorithm>
 #include <queue>
@@ -411,17 +412,17 @@ MediaFormatReader::DecoderFactory::DoIni
   auto& ownerData = mOwner->GetDecoderData(aTrack);
   auto& data = aTrack == TrackInfo::kAudioTrack ? mAudio : mVideo;
 
   data.mDecoder->Init()->Then(
     mOwner->OwnerThread(), __func__,
     [this, &data, &ownerData] (TrackType aTrack) {
       data.mInitPromise.Complete();
       data.mStage = Stage::None;
-      MutexAutoLock lock(ownerData.mMutex);
+      MonitorAutoLock mon(ownerData.mMonitor);
       ownerData.mDecoder = data.mDecoder.forget();
       ownerData.mDescription = ownerData.mDecoder->GetDescriptionName();
       mOwner->SetVideoDecodeThreshold();
       mOwner->ScheduleUpdate(aTrack);
     },
     [this, &data, aTrack] (MediaResult aError) {
       data.mInitPromise.Complete();
       data.mStage = Stage::None;
@@ -2657,21 +2658,21 @@ MediaFormatReader::GetImageContainer()
 void
 MediaFormatReader::GetMozDebugReaderData(nsACString& aString)
 {
   nsAutoCString result;
   const char* audioName = "unavailable";
   const char* videoName = audioName;
 
   if (HasAudio()) {
-    MutexAutoLock lock(mAudio.mMutex);
+    MonitorAutoLock mon(mAudio.mMonitor);
     audioName = mAudio.mDescription;
   }
   if (HasVideo()) {
-    MutexAutoLock mon(mVideo.mMutex);
+    MonitorAutoLock mon(mVideo.mMonitor);
     videoName = mVideo.mDescription;
   }
 
   result += nsPrintfCString("audio decoder: %s\n", audioName);
   result += nsPrintfCString("audio frames decoded: %lld\n",
                             mAudio.mNumSamplesOutputTotal);
   if (HasAudio()) {
     result += nsPrintfCString("audio state: ni=%d no=%d ie=%d demuxr:%d demuxq:%d tt:%f tths:%d in:%llu out:%llu qs=%u pending:%u waiting:%d wfk:%d sid:%u\n",
--- a/dom/media/MediaFormatReader.h
+++ b/dom/media/MediaFormatReader.h
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #if !defined(MediaFormatReader_h_)
 #define MediaFormatReader_h_
 
 #include "mozilla/Atomics.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/TaskQueue.h"
-#include "mozilla/Mutex.h"
+#include "mozilla/Monitor.h"
 
 #include "MediaEventSource.h"
 #include "MediaDataDemuxer.h"
 #include "MediaDecoderReader.h"
 #include "nsAutoPtr.h"
 #include "PDMFactory.h"
 
 namespace mozilla {
@@ -202,17 +202,17 @@ private:
   };
 
   struct DecoderData {
     DecoderData(MediaFormatReader* aOwner,
                 MediaData::Type aType,
                 uint32_t aNumOfMaxError)
       : mOwner(aOwner)
       , mType(aType)
-      , mMutex("DecoderData")
+      , mMonitor("DecoderData")
       , mDescription("shutdown")
       , mUpdateScheduled(false)
       , mDemuxEOS(false)
       , mWaitingForData(false)
       , mWaitingForKey(false)
       , mReceivedNewData(false)
       , mOutputRequested(false)
       , mDecodePending(false)
@@ -236,24 +236,24 @@ private:
     MediaData::Type mType;
     RefPtr<MediaTrackDemuxer> mTrackDemuxer;
     // TaskQueue on which decoder can choose to decode.
     // Only non-null up until the decoder is created.
     RefPtr<TaskQueue> mTaskQueue;
     // Callback that receives output and error notifications from the decoder.
     nsAutoPtr<DecoderCallback> mCallback;
 
-    // Mutex protecting mDescription and mDecoder.
-    Mutex mMutex;
+    // Monitor protecting mDescription and mDecoder.
+    Monitor mMonitor;
     // The platform decoder.
     RefPtr<MediaDataDecoder> mDecoder;
     const char* mDescription;
     void ShutdownDecoder()
     {
-      MutexAutoLock lock(mMutex);
+      MonitorAutoLock mon(mMonitor);
       if (mDecoder) {
         mDecoder->Shutdown();
       }
       mDescription = "shutdown";
       mDecoder = nullptr;
     }
 
     // Only accessed from reader's task queue.