Commit c3ebcd4b authored by Paul Adenot's avatar Paul Adenot
Browse files

Bug 1743834 - Handle the fact that it is possible to not have the ended...

Bug 1743834 - Handle the fact that it is possible to not have the ended promise on AudioSink shutdown, when muting. r=alwu

It can be resolved from the audio callback thread, which isn't synchronized with
the MDSM thread event loop.

Differential Revision: https://phabricator.services.mozilla.com/D146198
parent 8d609808
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -176,8 +176,12 @@ void AudioSinkWrapper::OnMuted(bool aMuted) {
      }
      Maybe<MozPromiseHolder<MediaSink::EndedPromise>> rv =
          mAudioSink->Shutdown(ShutdownCause::Muting);
      MOZ_ASSERT(rv.isSome());
      // There will generally be a promise here, except if the stream has
      // errored out, or if it has just finished. In both cases, the promise has
      // been handled appropriately, there is nothing to do.
      if (rv.isSome()) {
        mEndedPromiseHolder = std::move(rv.ref());
      }
      mAudioSink = nullptr;
    }
  } else {