Commit 50f5f91b authored by Andreas Pehrson's avatar Andreas Pehrson
Browse files

Bug 1657246 - Unset AudioCallbackDriver::mStarted on error. r=padenot

Start() will assert !mStarted, but only Stop() unsets it. In case we receive an
error through the state callback and try to restart the driver we fail the above
assert. This patch unsets mStarted on error, and moves the Stop() unsetting to
the STOPPED part of the state callback, to contain all the unsetting there.

Differential Revision: https://phabricator.services.mozilla.com/D94564
parent 9639dbe7
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -782,7 +782,6 @@ void AudioCallbackDriver::Stop() {
  if (cubeb_stream_stop(mAudioStream) != CUBEB_OK) {
    NS_WARNING("Could not stop cubeb stream for MTG.");
  }
  mStarted = false;
}

void AudioCallbackDriver::Shutdown() {
@@ -1072,9 +1071,11 @@ void AudioCallbackDriver::StateCallback(cubeb_state aState) {
    if (streamState == AudioStreamState::Running) {
      MOZ_ASSERT(!ThreadRunning());
      FallbackToSystemClockDriver();
      mStarted = false;
    }
  } else if (aState == CUBEB_STATE_STOPPED) {
    MOZ_ASSERT(!ThreadRunning());
    mStarted = false;
  }
}