Bug 1276852 - Assert AudioStream::Start() is called when mState is INITIALIZED. r=kinetik.
authorJW Wang <jwwang@mozilla.com>
Tue, 31 May 2016 14:33:03 +0800
changeset 340889 bc2bd91854befe145331375bb36cb89dd3f9f3ba
parent 340888 bdb2c38f67dfa6fec43aa81b1e6e0153fd9d9554
child 340890 b6fe7fa88db0a4103d175bf5b02cd47c2c6722e6
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik
bugs1276852
milestone49.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 1276852 - Assert AudioStream::Start() is called when mState is INITIALIZED. r=kinetik. MozReview-Commit-ID: DeGSEpSWYSM
dom/media/AudioStream.cpp
--- a/dom/media/AudioStream.cpp
+++ b/dom/media/AudioStream.cpp
@@ -396,26 +396,20 @@ AudioStream::SetVolume(double aVolume)
     NS_WARNING("Could not change volume on cubeb stream.");
   }
 }
 
 void
 AudioStream::Start()
 {
   MonitorAutoLock mon(mMonitor);
-  if (mState == INITIALIZED) {
-    // DataCallback might be called before InvokeCubeb returns
-    // if cubeb_stream_start() succeeds. mState must be set to STARTED
-    // beforehand.
-    mState = STARTED;
-    if (InvokeCubeb(cubeb_stream_start) != CUBEB_OK) {
-      mState = ERRORED;
-    }
-    LOG("started, state %s", mState == STARTED ? "STARTED" : "ERRORED");
-  }
+  MOZ_ASSERT(mState == INITIALIZED);
+  auto r = InvokeCubeb(cubeb_stream_start);
+  mState = r == CUBEB_OK ? STARTED : ERRORED;
+  LOG("started, state %s", mState == STARTED ? "STARTED" : "ERRORED");
 }
 
 void
 AudioStream::Pause()
 {
   MonitorAutoLock mon(mMonitor);
 
   if (mState == ERRORED) {