Bug 1276569. Part 1 - remove null checks. r=kinetik. draft 1276569_fix_AudioStream
authorJW Wang <jwwang@mozilla.com>
Mon, 30 May 2016 16:05:28 +0800
branch1276569_fix_AudioStream
changeset 372889 806b4eff3b6e43964bb6fd8d9e7a735a6bcfa5e6
parent 372888 41be3d54254c45cdc18759d3c194da62303d7067
child 372890 c8fb5f479ba61f9763b64cc0a90a1c29ff8e0e0d
push id19619
push userjwwang@mozilla.com
push dateMon, 30 May 2016 13:01:55 +0000
reviewerskinetik
bugs1276569
milestone49.0a1
Bug 1276569. Part 1 - remove null checks. r=kinetik. MozReview-Commit-ID: IpX4B2GTr9k
dom/media/AudioStream.cpp
--- a/dom/media/AudioStream.cpp
+++ b/dom/media/AudioStream.cpp
@@ -418,19 +418,16 @@ AudioStream::Start()
   MonitorAutoLock mon(mMonitor);
   StartUnlocked();
 }
 
 void
 AudioStream::StartUnlocked()
 {
   mMonitor.AssertCurrentThreadOwns();
-  if (!mCubebStream) {
-    return;
-  }
 
   if (mState == INITIALIZED) {
     mState = STARTED;
     int r;
     {
       MonitorAutoUnlock mon(mMonitor);
       r = cubeb_stream_start(mCubebStream.get());
       // DataCallback might be called before we exit this scope
@@ -448,17 +445,17 @@ void
 AudioStream::Pause()
 {
   MonitorAutoLock mon(mMonitor);
 
   if (mState == ERRORED) {
     return;
   }
 
-  if (!mCubebStream || (mState != STARTED && mState != RUNNING)) {
+  if (mState != STARTED && mState != RUNNING) {
     mState = STOPPED; // which also tells async OpenCubeb not to start, just init
     return;
   }
 
   int r;
   {
     MonitorAutoUnlock mon(mMonitor);
     r = cubeb_stream_stop(mCubebStream.get());
@@ -467,17 +464,17 @@ AudioStream::Pause()
     mState = STOPPED;
   }
 }
 
 void
 AudioStream::Resume()
 {
   MonitorAutoLock mon(mMonitor);
-  if (!mCubebStream || mState != STOPPED) {
+  if (mState != STOPPED) {
     return;
   }
 
   int r;
   {
     MonitorAutoUnlock mon(mMonitor);
     r = cubeb_stream_start(mCubebStream.get());
   }
@@ -518,17 +515,17 @@ AudioStream::GetPositionInFrames()
   return mAudioClock.GetPositionInFrames();
 }
 
 int64_t
 AudioStream::GetPositionInFramesUnlocked()
 {
   mMonitor.AssertCurrentThreadOwns();
 
-  if (!mCubebStream || mState == ERRORED) {
+  if (mState == ERRORED) {
     return -1;
   }
 
   uint64_t position = 0;
   {
     MonitorAutoUnlock mon(mMonitor);
     if (cubeb_stream_get_position(mCubebStream.get(), &position) != CUBEB_OK) {
       return -1;