bug 1436267 fallback from audio callback to system clock driver on error only once r?padenot draft
authorKarl Tomlinson <karlt+@karlt.net>
Wed, 07 Feb 2018 20:16:01 +1300
changeset 751972 d38af99bbd72c4e84949fac661435930c5172367
parent 751903 e1954b02d9e39bdb7c1f17aa95ca9cad5d5c14ae
push id98113
push userktomlinson@mozilla.com
push dateWed, 07 Feb 2018 09:29:46 +0000
reviewerspadenot
bugs1436267
milestone60.0a1
bug 1436267 fallback from audio callback to system clock driver on error only once r?padenot Usually, mShouldFallbackIfError has been reset to false in DataCallback() before Stop() is called. However, if fallback to a system clock driver due to cubeb error had already occurred, then mShouldFallbackIfError would not have been reset, and Stop() is still called. With mShouldFallbackIfError still true, a cubeb error in stop would have created another fallback thread. I expect that resetting mShouldFallbackIfError in Stop() would also be an effective alternative solution, but resetting on StateCallback() happens earlier, which would be an advantage if any additional errors could possibly be reported to StateCallback(). MozReview-Commit-ID: E9j7PQmS3O4
dom/media/GraphDriver.cpp
--- a/dom/media/GraphDriver.cpp
+++ b/dom/media/GraphDriver.cpp
@@ -1035,16 +1035,17 @@ AudioCallbackDriver::DataCallback(const 
 }
 
 void
 AudioCallbackDriver::StateCallback(cubeb_state aState)
 {
   LOG(LogLevel::Debug, ("AudioCallbackDriver State: %d", aState));
 
   if (aState == CUBEB_STATE_ERROR && mShouldFallbackIfError) {
+    mShouldFallbackIfError = false;
     MonitorAutoLock lock(GraphImpl()->GetMonitor());
     RemoveCallback();
     FallbackToSystemClockDriver();
   }
 }
 
 void
 AudioCallbackDriver::MixerCallback(AudioDataValue* aMixedBuffer,