Commit 056db4b0 authored by Andreas Pehrson's avatar Andreas Pehrson
Browse files

Bug 1657246 - Don't fall back to a system driver if it's already running on error. r=padenot

A fallback driver is started whenever an audio callback driver is started, to
run the graph while the audio driver starts, which can be slow.

If the audio driver has started (according to the StateCallback) but not had a
callback yet, it won't have stopped the fallback driver. The handover from the
fallback driver to the audio driver is not yet done.

We do not want to start another fallback driver in this case.

Differential Revision: https://phabricator.services.mozilla.com/D94566
parent 3594402f
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1070,8 +1070,13 @@ void AudioCallbackDriver::StateCallback(cubeb_state aState) {
    // or another driver has control of the graph.
    if (streamState == AudioStreamState::Running) {
      MOZ_ASSERT(!ThreadRunning());
      FallbackToSystemClockDriver();
      mStarted = false;
      if (mFallbackDriverState == FallbackDriverState::None) {
        // Only switch to fallback if it's not already running. It could be
        // running with the callback driver having started but not seen a single
        // callback yet. I.e., handover from fallback to callback is not done.
        FallbackToSystemClockDriver();
      }
    }
  } else if (aState == CUBEB_STATE_STOPPED) {
    MOZ_ASSERT(!ThreadRunning());