From 338c6a43235768f1a0e73f268ee96d74eafe8f15 Mon Sep 17 00:00:00 2001 From: Karl Tomlinson Date: Wed, 7 Feb 2018 20:16:01 +1300 Subject: Bug 1426603 - Fallback from audio callback to system clock driver on error only once. r=padenot, a=RyanVM 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 | 1 + 1 file changed, 1 insertion(+) (limited to 'dom') diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp index 9b74bd58c..40e3b72cf 100644 --- a/dom/media/GraphDriver.cpp +++ b/dom/media/GraphDriver.cpp @@ -1055,6 +1055,7 @@ AudioCallbackDriver::StateCallback(cubeb_state aState) { STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver State: %d", aState)); if (aState == CUBEB_STATE_ERROR && mShouldFallbackIfError) { + mShouldFallbackIfError = false; MonitorAutoLock lock(GraphImpl()->GetMonitor()); // Fall back to a driver using a normal thread. If needed, // the graph will try to re-open an audio stream later. -- cgit v1.2.3