Bug 1887774 rename ConnectToNativeDevice introspection function to ConnectedToNativeDevice r=pehrsons

Differential Revision: https://phabricator.services.mozilla.com/D206870
This commit is contained in:
Karl Tomlinson 2024-04-10 20:34:10 +00:00
parent c6210d5d37
commit c0cd86bb97
4 changed files with 16 additions and 16 deletions

View File

@ -127,12 +127,12 @@ NotNull<AudioDataListener*> DeviceInputConsumerTrack::GetAudioDataListener()
return WrapNotNull(mListener.get());
}
bool DeviceInputConsumerTrack::ConnectToNativeDevice() const {
bool DeviceInputConsumerTrack::ConnectedToNativeDevice() const {
MOZ_ASSERT(NS_IsMainThread());
return mDeviceInputTrack && mDeviceInputTrack->AsNativeInputTrack();
}
bool DeviceInputConsumerTrack::ConnectToNonNativeDevice() const {
bool DeviceInputConsumerTrack::ConnectedToNonNativeDevice() const {
MOZ_ASSERT(NS_IsMainThread());
return mDeviceInputTrack && mDeviceInputTrack->AsNonNativeInputTrack();
}

View File

@ -76,8 +76,8 @@ class DeviceInputConsumerTrack : public ProcessedMediaTrack {
void DisconnectDeviceInput();
Maybe<CubebUtils::AudioDeviceID> DeviceId() const;
NotNull<AudioDataListener*> GetAudioDataListener() const;
bool ConnectToNativeDevice() const;
bool ConnectToNonNativeDevice() const;
bool ConnectedToNativeDevice() const;
bool ConnectedToNonNativeDevice() const;
// Any thread:
DeviceInputConsumerTrack* AsDeviceInputConsumerTrack() override {

View File

@ -619,8 +619,8 @@ TEST(TestAudioTrackGraph, DeviceChangedCallback)
TestDeviceInputConsumerTrack::Create(graphImpl);
track1->ConnectDeviceInput(device1, listener1.get(), PRINCIPAL_HANDLE_NONE);
EXPECT_TRUE(track1->ConnectToNativeDevice());
EXPECT_FALSE(track1->ConnectToNonNativeDevice());
EXPECT_TRUE(track1->ConnectedToNativeDevice());
EXPECT_FALSE(track1->ConnectedToNonNativeDevice());
auto started =
Invoke([&] { return graphImpl->NotifyWhenDeviceStarted(nullptr); });
RefPtr<SmartMockCubebStream> stream1 = WaitFor(cubeb->StreamInitEvent());
@ -636,8 +636,8 @@ TEST(TestAudioTrackGraph, DeviceChangedCallback)
TestDeviceInputConsumerTrack::Create(graphImpl);
track2->ConnectDeviceInput(device2, listener2.get(), PRINCIPAL_HANDLE_NONE);
EXPECT_FALSE(track2->ConnectToNativeDevice());
EXPECT_TRUE(track2->ConnectToNonNativeDevice());
EXPECT_FALSE(track2->ConnectedToNativeDevice());
EXPECT_TRUE(track2->ConnectedToNonNativeDevice());
RefPtr<SmartMockCubebStream> stream2 = WaitFor(cubeb->StreamInitEvent());
EXPECT_TRUE(stream2->mHasInput);
EXPECT_FALSE(stream2->mHasOutput);
@ -851,8 +851,8 @@ TEST(TestAudioTrackGraph, RestartAudioIfMaxChannelCountChanged)
track1->ConnectDeviceInput(nativeDevice, listener1.get(),
PRINCIPAL_HANDLE_NONE);
EXPECT_TRUE(track1->ConnectToNativeDevice());
EXPECT_FALSE(track1->ConnectToNonNativeDevice());
EXPECT_TRUE(track1->ConnectedToNativeDevice());
EXPECT_FALSE(track1->ConnectedToNonNativeDevice());
auto started =
Invoke([&] { return graphImpl->NotifyWhenDeviceStarted(nullptr); });
nativeStream = WaitFor(cubeb->StreamInitEvent());
@ -890,8 +890,8 @@ TEST(TestAudioTrackGraph, RestartAudioIfMaxChannelCountChanged)
TestDeviceInputConsumerTrack::Create(graphImpl);
track3->ConnectDeviceInput(nonNativeDevice, listener3.get(),
PRINCIPAL_HANDLE_NONE);
EXPECT_FALSE(track3->ConnectToNativeDevice());
EXPECT_TRUE(track3->ConnectToNonNativeDevice());
EXPECT_FALSE(track3->ConnectedToNativeDevice());
EXPECT_TRUE(track3->ConnectedToNonNativeDevice());
RefPtr<SmartMockCubebStream> nonNativeStream =
WaitFor(cubeb->StreamInitEvent());

View File

@ -150,16 +150,16 @@ TEST_F(TestDeviceInputTrack, DeviceInputConsumerTrack) {
RefPtr<TestDeviceInputConsumerTrack> track1 =
TestDeviceInputConsumerTrack::Create(mGraph);
track1->ConnectDeviceInput(device1, listener1.get(), testPrincipal);
EXPECT_TRUE(track1->ConnectToNativeDevice());
EXPECT_FALSE(track1->ConnectToNonNativeDevice());
EXPECT_TRUE(track1->ConnectedToNativeDevice());
EXPECT_FALSE(track1->ConnectedToNonNativeDevice());
const CubebUtils::AudioDeviceID device2 = (void*)2;
RefPtr<TestAudioDataListener> listener2 = new TestAudioDataListener(2, false);
RefPtr<TestDeviceInputConsumerTrack> track2 =
TestDeviceInputConsumerTrack::Create(mGraph);
track2->ConnectDeviceInput(device2, listener2.get(), testPrincipal);
EXPECT_FALSE(track2->ConnectToNativeDevice());
EXPECT_TRUE(track2->ConnectToNonNativeDevice());
EXPECT_FALSE(track2->ConnectedToNativeDevice());
EXPECT_TRUE(track2->ConnectedToNonNativeDevice());
track2->Destroy();
mGraph->RemoveTrackGraphThread(track2);