Bug 1042884 - Do nothing in AudioStream::OpenCubeb() after shutdown. r=kinetik, a=sledru
authorJW Wang <jwwang@mozilla.com>
Wed, 23 Jul 2014 20:58:00 +0200
changeset 217291 e3e0c615529a00ea9fd44fcebc782c679b36b2e3
parent 217290 2582bc550881d281438ce1e872d35a739d974a84
child 217292 80c6d41ee6086e000b5b62a1cf9ebc05f5532342
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)
reviewerskinetik, sledru
bugs1042884
milestone33.0a2
Bug 1042884 - Do nothing in AudioStream::OpenCubeb() after shutdown. r=kinetik, a=sledru
content/media/AudioStream.cpp
--- a/content/media/AudioStream.cpp
+++ b/content/media/AudioStream.cpp
@@ -545,16 +545,23 @@ AudioStream::Init(int32_t aNumChannels, 
 }
 
 // This code used to live inside AudioStream::Init(), but on Mac (others?)
 // it has been known to take 300-800 (or even 8500) ms to execute(!)
 nsresult
 AudioStream::OpenCubeb(cubeb_stream_params &aParams,
                        LatencyRequest aLatencyRequest)
 {
+  {
+    MonitorAutoLock mon(mMonitor);
+    if (mState == AudioStream::SHUTDOWN) {
+      return NS_ERROR_FAILURE;
+    }
+  }
+
   cubeb* cubebContext = GetCubebContext();
   if (!cubebContext) {
     MonitorAutoLock mon(mMonitor);
     mState = AudioStream::ERRORED;
     return NS_ERROR_FAILURE;
   }
 
   // If the latency pref is set, use it. Otherwise, if this stream is intended