commit 99020e68b307489f5e68deaae9f12d66fa5b9d5b
parent c629503dde0e84276b9c47e5f72453fdb79aad3a
Author: Karl Tomlinson <karlt+@karlt.net>
Date: Mon, 17 Nov 2025 23:02:52 +0000
Bug 2000076 Wait for primary stream before starting secondary stream r=pehrsons
The previous code happened to create the streams in the correct order because
the first MediaTrackGraph iteration would process control messsages from only
the first graph stable state runnable. A subsequent patch will allow the
graph to process control messages from multiple stable state runnables, if
available, in the first MediaTrackGraph iteration.
Differential Revision: https://phabricator.services.mozilla.com/D272606
Diffstat:
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/dom/media/gtest/TestAudioTrackGraph.cpp b/dom/media/gtest/TestAudioTrackGraph.cpp
@@ -2759,6 +2759,9 @@ TEST(TestAudioTrackGraph, ClockDriftExpectation)
DispatchFunction([&] {
createInputProcessing(nullptr, &processingTrack1, &inputProcessing1);
});
+ RefPtr<SmartMockCubebStream> primaryStream =
+ WaitFor(cubeb->StreamInitEvent());
+ EXPECT_GT(primaryStream->OutputChannels(), 0U);
// Non-native input
const auto* nonNativeInputDeviceID = CubebUtils::AudioDeviceID(1);
RefPtr<AudioProcessingTrack> processingTrack2;
@@ -2769,18 +2772,10 @@ TEST(TestAudioTrackGraph, ClockDriftExpectation)
processingTrack2->AddAudioOutput(nullptr, nullptr, rate);
});
- RefPtr<SmartMockCubebStream> primaryStream;
- RefPtr<SmartMockCubebStream> nonNativeInputStream;
- WaitUntil(cubeb->StreamInitEvent(),
- [&](RefPtr<SmartMockCubebStream>&& stream) {
- if (stream->OutputChannels() > 0) {
- primaryStream = std::move(stream);
- return false;
- }
- nonNativeInputStream = std::move(stream);
- return true;
- });
+ RefPtr<SmartMockCubebStream> nonNativeInputStream =
+ WaitFor(cubeb->StreamInitEvent());
EXPECT_EQ(nonNativeInputStream->GetInputDeviceID(), nonNativeInputDeviceID);
+ EXPECT_EQ(nonNativeInputStream->OutputChannels(), 0U);
// Wait until non-native input signal reaches the output, when input
// processing has run and so has been configured.