Bug 1869043 allow a device to be specified with MediaTrackGraph::NotifyWhenDeviceStarted() r=pehrsons

The aTrack parameter is no longer required because, as of
https://phabricator.services.mozilla.com/D198231, MediaStreamRenderer no
longer needs the promise to be rejected when the track is destroyed.

Instead the wait for the device to start is terminated when no outputs to the
specified device remain.

NotifyWhenDeviceStarted() is removed from some gtests that don't have any
track outputs.  They use WaitFor(cubeb->StreamInitEvent()) to wait for a
device anyway and don't need to know precisely when the graph switches from
the fallback driver to the callback.  If a test does need this precise timing
it can use NotifyWhenDeviceStarted() if MediaTrack::AddAudioOutput() is used.

Differential Revision: https://phabricator.services.mozilla.com/D198232
This commit is contained in:
Karl Tomlinson
2024-01-16 09:14:07 +00:00
parent aeaab5796d
commit 532e71a558
6 changed files with 81 additions and 57 deletions

View File

@@ -859,11 +859,12 @@ class HTMLMediaElement::MediaStreamRenderer
MOZ_ASSERT(!mSetAudioDevicePromise.IsEmpty());
mDeviceStartedRequest.Complete();
// The AudioStreamTrack::AddAudioOutput() promise is rejected
// either when the track ends or the graph is force shutdown.
// Rejection is treated in the same way as resolution for
// consistency with the synchronous resolution when
// AddAudioOutput() is called on a track that has already
// ended.
// either when the graph no longer needs the device, in which
// case this handler would have already been disconnected, or
// the graph is force shutdown.
// mSetAudioDevicePromise is resolved regardless of whether
// the AddAudioOutput() promises resolve or reject because
// the underlying device has been changed.
mSetAudioDevicePromise.Resolve(true, __func__);
})
->Track(mDeviceStartedRequest);