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
--- 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,