tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit d08655995c5c6db442e1a9249758411ddd2e606f
parent 95f02e9db23d21b006e29e906f3b4f820618d3c4
Author: Karl Tomlinson <karlt+@karlt.net>
Date:   Thu, 27 Nov 2025 18:29:09 +0000

Bug 2001034 add an audio output to NotifyDeviceStarted test so that NotifyWhenDeviceStarted() will resolve r=pehrsons

NotifyWhenDeviceStarted() rejects immediately when there are no output devices.
Immediate rejection meant that the track was often being removed before the
mock cubeb stream had started, and so there was no StreamDestroyEvent() to
WaitFor().

Differential Revision: https://phabricator.services.mozilla.com/D274245

Diffstat:
Mdom/media/MediaTrackGraph.h | 2+-
Mdom/media/MediaTrackGraphImpl.h | 2+-
Mdom/media/gtest/TestAudioTrackGraph.cpp | 4++--
3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dom/media/MediaTrackGraph.h b/dom/media/MediaTrackGraph.h @@ -1153,7 +1153,7 @@ class MediaTrackGraph { /* From the main thread, ask the MTG to resolve the returned promise when * the device specified has started. * A null aDeviceID indicates the default audio output device. - * The promise is rejected with NS_ERROR_INVALID_ARG if aSink does not + * The promise is rejected with NS_ERROR_INVALID_ARG if aDeviceID does not * correspond to any output devices used by the graph, or * NS_ERROR_NOT_AVAILABLE if outputs to the device are removed or * NS_ERROR_ILLEGAL_DURING_SHUTDOWN if the graph is force shut down diff --git a/dom/media/MediaTrackGraphImpl.h b/dom/media/MediaTrackGraphImpl.h @@ -378,7 +378,7 @@ class MediaTrackGraphImpl : public MediaTrackGraph, /* From the main thread, ask the MTG to resolve the returned promise when * the device specified has started. * A null aDeviceID indicates the default audio output device. - * The promise is rejected with NS_ERROR_INVALID_ARG if aSink does not + * The promise is rejected with NS_ERROR_INVALID_ARG if aDeviceID does not * correspond to any output devices used by the graph, or * NS_ERROR_NOT_AVAILABLE if outputs to the device are removed or * NS_ERROR_ILLEGAL_DURING_SHUTDOWN if the graph is force shut down diff --git a/dom/media/gtest/TestAudioTrackGraph.cpp b/dom/media/gtest/TestAudioTrackGraph.cpp @@ -308,11 +308,11 @@ TEST(TestAudioTrackGraph, NotifyDeviceStarted) nullptr, GetMainThreadSerialEventTarget()); RefPtr<SourceMediaTrack> dummySource; - (void)WaitFor(InvokeAsync([&] { + (void)WaitForResolve(InvokeAsync([&] { // Dummy track to make graph rolling. Add it and remove it to remove the // graph from the global hash table and let it shutdown. dummySource = graph->CreateSourceTrack(MediaSegment::AUDIO); - + dummySource->AddAudioOutput(reinterpret_cast<void*>(1), nullptr); return graph->NotifyWhenDeviceStarted(nullptr); }));