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

--HG--
extra : rebase_source : 200993c9e99475101c429005cfadb7260df29067
This commit is contained in:
Karl Tomlinson 2018-02-07 20:16:01 +13:00
parent 8ecfc436b4
commit df12c01556

View File

@ -1040,6 +1040,7 @@ 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();