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 208193 eb3c7dd5ac83
parent 208192 26341b100b6d
child 208194 f1b3abcc9555
push id3761
push userryanvm@gmail.com
push date2014-07-29 19:29 +0000
treeherdermozilla-beta@f1b3abcc9555 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik, sledru
bugs1042884
milestone32.0
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
@@ -460,16 +460,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