From 0e79a06bd8ab5529dff9c33aa22e9862e01c62e7 Mon Sep 17 00:00:00 2001 From: hai007 Date: Mon, 28 Apr 2025 05:08:03 -0700 Subject: [PATCH] Automated Code Change PiperOrigin-RevId: 752263247 --- connections/implementation/mediums/webrtc.cc | 14 ++--- connections/implementation/mediums/webrtc.h | 2 +- .../mediums/webrtc/connection_flow.cc | 61 +++++++++---------- .../mediums/webrtc/connection_flow.h | 22 +++---- .../mediums/webrtc/connection_flow_test.cc | 24 ++++---- .../mediums/webrtc/webrtc_socket_impl_test.cc | 39 ++++++++---- internal/platform/implementation/g3/webrtc.cc | 4 +- internal/platform/implementation/webrtc.h | 2 +- .../platform/implementation/windows/webrtc.cc | 4 +- .../implementation/windows/webrtc_test.cc | 6 +- internal/platform/webrtc.h | 2 +- 11 files changed, 96 insertions(+), 84 deletions(-) diff --git a/connections/implementation/mediums/webrtc.cc b/connections/implementation/mediums/webrtc.cc index 456e2cd6..9a96f9f8 100644 --- a/connections/implementation/mediums/webrtc.cc +++ b/connections/implementation/mediums/webrtc.cc @@ -756,7 +756,7 @@ std::unique_ptr WebRtc::CreateConnectionFlow( }}, }, { - .adapter_type_changed_cb = {[this](rtc::AdapterType adapter_type) { + .adapter_type_changed_cb = {[this](webrtc::AdapterType adapter_type) { OffloadFromThread("rtc-adapter-type-changed", [this, adapter_type]() { if (FeatureFlags::GetInstance() @@ -770,13 +770,13 @@ std::unique_ptr WebRtc::CreateConnectionFlow( *medium_); } -void WebRtc::AdapterTypeChangedHandler(rtc::AdapterType adapter_type) { +void WebRtc::AdapterTypeChangedHandler(webrtc::AdapterType adapter_type) { MutexLock lock(&mutex_); - is_using_cellular_ = adapter_type == rtc::ADAPTER_TYPE_CELLULAR || - adapter_type == rtc::ADAPTER_TYPE_CELLULAR_2G || - adapter_type == rtc::ADAPTER_TYPE_CELLULAR_3G || - adapter_type == rtc::ADAPTER_TYPE_CELLULAR_4G || - adapter_type == rtc::ADAPTER_TYPE_CELLULAR_5G; + is_using_cellular_ = adapter_type == webrtc::ADAPTER_TYPE_CELLULAR || + adapter_type == webrtc::ADAPTER_TYPE_CELLULAR_2G || + adapter_type == webrtc::ADAPTER_TYPE_CELLULAR_3G || + adapter_type == webrtc::ADAPTER_TYPE_CELLULAR_4G || + adapter_type == webrtc::ADAPTER_TYPE_CELLULAR_5G; } void WebRtc::RemoveConnectionFlow(const WebrtcPeerId& remote_peer_id) { diff --git a/connections/implementation/mediums/webrtc.h b/connections/implementation/mediums/webrtc.h index 4bcf1231..536956c3 100644 --- a/connections/implementation/mediums/webrtc.h +++ b/connections/implementation/mediums/webrtc.h @@ -236,7 +236,7 @@ class WebRtc { ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); // Runs on |single_thread_executor_|. - void AdapterTypeChangedHandler(rtc::AdapterType adapter_type) + void AdapterTypeChangedHandler(webrtc::AdapterType adapter_type) ABSL_LOCKS_EXCLUDED(mutex_); void OffloadFromThread(const std::string& name, Runnable runnable); diff --git a/connections/implementation/mediums/webrtc/connection_flow.cc b/connections/implementation/mediums/webrtc/connection_flow.cc index 578dc901..321b0a10 100644 --- a/connections/implementation/mediums/webrtc/connection_flow.cc +++ b/connections/implementation/mediums/webrtc/connection_flow.cc @@ -187,8 +187,8 @@ void ConnectionFlow::CreateOfferOnSignalingThread( CreateSocketFromDataChannel(result.MoveValue()); webrtc::PeerConnectionInterface::RTCOfferAnswerOptions options; - rtc::scoped_refptr observer( - new rtc::RefCountedObject( + webrtc::scoped_refptr observer( + new webrtc::RefCountedObject( this, success_future, State::kCreatingOffer, State::kWaitingForAnswer)); pc->CreateOffer(observer.get(), options); @@ -218,8 +218,8 @@ void ConnectionFlow::CreateAnswerOnSignalingThread( return; } webrtc::PeerConnectionInterface::RTCOfferAnswerOptions options; - rtc::scoped_refptr observer( - new rtc::RefCountedObject( + webrtc::scoped_refptr observer( + new webrtc::RefCountedObject( this, success_future, State::kCreatingAnswer, State::kWaitingToConnect)); auto pc = GetPeerConnection(); @@ -230,8 +230,8 @@ bool ConnectionFlow::SetLocalSessionDescription(SessionDescriptionWrapper sdp) { CHECK(!IsRunningOnSignalingThread()); if (!sdp.IsValid()) return false; - rtc::scoped_refptr observer( - new rtc::RefCountedObject()); + webrtc::scoped_refptr observer( + new webrtc::RefCountedObject()); if (!RunOnSignalingThread([this, observer, sdp = std::move(sdp)]() mutable { if (state_ == State::kEnded) { @@ -262,8 +262,8 @@ bool ConnectionFlow::SetRemoteSessionDescription(SessionDescriptionWrapper sdp, State exit_state) { if (!sdp.IsValid()) return false; - rtc::scoped_refptr observer( - new rtc::RefCountedObject()); + webrtc::scoped_refptr observer( + new webrtc::RefCountedObject()); if (!RunOnSignalingThread([this, observer, sdp = std::move(sdp), expected_entry_state, exit_state]() mutable { @@ -373,9 +373,9 @@ bool ConnectionFlow::InitPeerConnection(WebRtcMedium& webrtc_medium) { // to access, but it is not safe to access ConnectionFlow member variables // unless the Future::Set() returns true. webrtc_medium.CreatePeerConnection( - this, - [this, success_future](rtc::scoped_refptr - peer_connection) mutable { + this, [this, success_future]( + webrtc::scoped_refptr + peer_connection) mutable { if (!peer_connection) { success_future.Set(false); return; @@ -415,7 +415,7 @@ void ConnectionFlow::OnSignalingStable() { } void ConnectionFlow::CreateSocketFromDataChannel( - rtc::scoped_refptr data_channel) { + webrtc::scoped_refptr data_channel) { NEARBY_LOGS(INFO) << "Creating data channel socket"; auto socket = std::make_unique("WebRtcSocket", std::move(data_channel)); @@ -455,7 +455,7 @@ void ConnectionFlow::OnSignalingChange( } void ConnectionFlow::OnDataChannel( - rtc::scoped_refptr data_channel) { + webrtc::scoped_refptr data_channel) { NEARBY_LOGS(INFO) << "OnDataChannel"; CHECK(IsRunningOnSignalingThread()); CreateSocketFromDataChannel(std::move(data_channel)); @@ -486,7 +486,7 @@ void ConnectionFlow::OnRenegotiationNeeded() { } void ConnectionFlow::OnIceSelectedCandidatePairChanged( - const cricket::CandidatePairChangeEvent& event) { + const webrtc::CandidatePairChangeEvent& event) { NEARBY_LOGS(INFO) << "OnIceSelectedCandidatePairChanged"; CHECK(IsRunningOnSignalingThread()); // TODO(edwinwu) - Implement the unit test for this. We should be able to get @@ -546,29 +546,28 @@ bool ConnectionFlow::RunOnSignalingThread(Runnable&& runnable) { } // We are off signaling thread, so we can't use peer connection's methods // but we can access the signaling thread handle. - pc->signaling_thread()->PostTask( - [can_run_tasks = std::weak_ptr(can_run_tasks_), - task = std::move(runnable)]() mutable { - // Don't run the task if the weak_ptr is no longer valid. - // shared_ptr |can_run_tasks_| is destroyed on the same thread - // (signaling thread). This guarantees that if the weak_ptr is valid - // when this task starts, it will stay valid until the task ends. - if (!can_run_tasks.lock()) { - NEARBY_LOGS(INFO) - << "Peer connection already closed. Cannot run tasks."; - return; - } - task(); - }); + pc->signaling_thread()->PostTask([can_run_tasks = + std::weak_ptr(can_run_tasks_), + task = std::move(runnable)]() mutable { + // Don't run the task if the weak_ptr is no longer valid. + // shared_ptr |can_run_tasks_| is destroyed on the same thread + // (signaling thread). This guarantees that if the weak_ptr is valid + // when this task starts, it will stay valid until the task ends. + if (!can_run_tasks.lock()) { + NEARBY_LOGS(INFO) << "Peer connection already closed. Cannot run tasks."; + return; + } + task(); + }); return true; } bool ConnectionFlow::IsRunningOnSignalingThread() { return signaling_thread_for_dcheck_only_ != nullptr && - signaling_thread_for_dcheck_only_ == rtc::Thread::Current(); + signaling_thread_for_dcheck_only_ == webrtc::Thread::Current(); } -rtc::scoped_refptr +webrtc::scoped_refptr ConnectionFlow::GetPeerConnection() { // We must use a mutex to ensure that peer connection is // fully initialized. @@ -578,7 +577,7 @@ ConnectionFlow::GetPeerConnection() { return peer_connection_; } -rtc::scoped_refptr +webrtc::scoped_refptr ConnectionFlow::GetAndResetPeerConnection() { MutexLock lock(&mutex_); return std::move(peer_connection_); diff --git a/connections/implementation/mediums/webrtc/connection_flow.h b/connections/implementation/mediums/webrtc/connection_flow.h index 4793cfa4..c3d01d3b 100644 --- a/connections/implementation/mediums/webrtc/connection_flow.h +++ b/connections/implementation/mediums/webrtc/connection_flow.h @@ -87,8 +87,8 @@ class ConnectionFlow : public webrtc::PeerConnectionObserver { }; struct AdapterTypeListener { - absl::AnyInvocable - adapter_type_changed_cb = DefaultCallback(); + absl::AnyInvocable + adapter_type_changed_cb = DefaultCallback(); }; // This method blocks on the creation of the peer connection object. @@ -139,18 +139,18 @@ class ConnectionFlow : public webrtc::PeerConnectionObserver { void OnIceCandidate(const webrtc::IceCandidateInterface* candidate) override; void OnSignalingChange( webrtc::PeerConnectionInterface::SignalingState new_state) override; - void OnDataChannel( - rtc::scoped_refptr data_channel) override; + void OnDataChannel(webrtc::scoped_refptr + data_channel) override; void OnIceGatheringChange( webrtc::PeerConnectionInterface::IceGatheringState new_state) override; void OnConnectionChange( webrtc::PeerConnectionInterface::PeerConnectionState new_state) override; void OnRenegotiationNeeded() override; void OnIceSelectedCandidatePairChanged( - const cricket::CandidatePairChangeEvent& event) override; + const webrtc::CandidatePairChangeEvent& event) override; // Public because it's used in tests too. - rtc::scoped_refptr GetPeerConnection(); + webrtc::scoped_refptr GetPeerConnection(); private: ConnectionFlow(LocalIceCandidateListener local_ice_candidate_listener, @@ -158,7 +158,7 @@ class ConnectionFlow : public webrtc::PeerConnectionObserver { AdapterTypeListener adapter_type_listener); // Resets peer connection reference. Returns old value. - rtc::scoped_refptr + webrtc::scoped_refptr GetAndResetPeerConnection(); void CreateOfferOnSignalingThread( Future success_future); @@ -171,7 +171,7 @@ class ConnectionFlow : public webrtc::PeerConnectionObserver { void OnSignalingStable() ABSL_LOCKS_EXCLUDED(mutex_); void CreateSocketFromDataChannel( - rtc::scoped_refptr data_channel); + webrtc::scoped_refptr data_channel); // TODO(bfranz): Consider whether this needs to be configurable per platform static constexpr absl::Duration kTimeout = absl::Milliseconds(250); @@ -218,7 +218,7 @@ class ConnectionFlow : public webrtc::PeerConnectionObserver { // because it allows us to do state management on the signaling thread too, // simplifies locking, and we don't have to block the current thread for every // peer connection call. - rtc::scoped_refptr peer_connection_ + webrtc::scoped_refptr peer_connection_ ABSL_GUARDED_BY(mutex_); // Used to hold a reference to the WebRtcSocket while the data channel is @@ -234,8 +234,8 @@ class ConnectionFlow : public webrtc::PeerConnectionObserver { // This shared_ptr is reset on the signaling thread when ConnectionFlow is // closed. This prevents us from running tasks on the signaling thread when // peer connection is closed. The value stored in |can_run_tasks_| is not - // used. We are using std::shared_ptr instead of rtc::WeakPtrFactory because - // the former is thread-safe. + // used. We are using std::shared_ptr instead of webrtc::WeakPtrFactory + // because the former is thread-safe. std::shared_ptr can_run_tasks_ = std::make_shared(); AdapterTypeListener adapter_type_listener_; diff --git a/connections/implementation/mediums/webrtc/connection_flow_test.cc b/connections/implementation/mediums/webrtc/connection_flow_test.cc index 3e7f5402..dae9a003 100644 --- a/connections/implementation/mediums/webrtc/connection_flow_test.cc +++ b/connections/implementation/mediums/webrtc/connection_flow_test.cc @@ -81,7 +81,7 @@ TEST_F(ConnectionFlowTest, SuccessfulOfferAnswerFlow) { offerer_socket_future.Set(std::move(socket)); }}, {.adapter_type_changed_cb = - [](rtc::AdapterType adapter_type) { + [](webrtc::AdapterType adapter_type) { // Do nothing }}, webrtc_medium_offerer); @@ -101,7 +101,7 @@ TEST_F(ConnectionFlowTest, SuccessfulOfferAnswerFlow) { answerer_socket_future.Set(std::move(socket)); }}, {.adapter_type_changed_cb = - [](rtc::AdapterType adapter_type) { + [](webrtc::AdapterType adapter_type) { // Do nothing }}, webrtc_medium_answerer); @@ -280,7 +280,7 @@ TEST_F(ConnectionFlowTest, TerminateAnswerer) { offerer_socket_future.Set(std::move(socket)); }}, {.adapter_type_changed_cb = - [](rtc::AdapterType adapter_type) { + [](webrtc::AdapterType adapter_type) { // Do nothing }}, webrtc_medium_offerer); @@ -300,9 +300,9 @@ TEST_F(ConnectionFlowTest, TerminateAnswerer) { answerer_socket_future.Set(std::move(wrapper)); }}, {.adapter_type_changed_cb = - [](rtc::AdapterType adapter_type) { - EXPECT_GE(adapter_type, rtc::ADAPTER_TYPE_UNKNOWN); - EXPECT_LE(adapter_type, rtc::ADAPTER_TYPE_CELLULAR_5G); + [](webrtc::AdapterType adapter_type) { + EXPECT_GE(adapter_type, webrtc::ADAPTER_TYPE_UNKNOWN); + EXPECT_LE(adapter_type, webrtc::ADAPTER_TYPE_CELLULAR_5G); }}, webrtc_medium_answerer); ASSERT_NE(answerer, nullptr); @@ -370,9 +370,9 @@ TEST_F(ConnectionFlowTest, TerminateOfferer) { offerer_socket_future.Set(std::move(socket)); }}, {.adapter_type_changed_cb = - [](rtc::AdapterType adapter_type) { - EXPECT_GE(adapter_type, rtc::ADAPTER_TYPE_UNKNOWN); - EXPECT_LE(adapter_type, rtc::ADAPTER_TYPE_CELLULAR_5G); + [](webrtc::AdapterType adapter_type) { + EXPECT_GE(adapter_type, webrtc::ADAPTER_TYPE_UNKNOWN); + EXPECT_LE(adapter_type, webrtc::ADAPTER_TYPE_CELLULAR_5G); }}, webrtc_medium_offerer); ASSERT_NE(offerer, nullptr); @@ -391,9 +391,9 @@ TEST_F(ConnectionFlowTest, TerminateOfferer) { answerer_socket_future.Set(std::move(wrapper)); }}, {.adapter_type_changed_cb = - [](rtc::AdapterType adapter_type) { - EXPECT_GE(adapter_type, rtc::ADAPTER_TYPE_UNKNOWN); - EXPECT_LE(adapter_type, rtc::ADAPTER_TYPE_CELLULAR_5G); + [](webrtc::AdapterType adapter_type) { + EXPECT_GE(adapter_type, webrtc::ADAPTER_TYPE_UNKNOWN); + EXPECT_LE(adapter_type, webrtc::ADAPTER_TYPE_CELLULAR_5G); }}, webrtc_medium_answerer); ASSERT_NE(answerer, nullptr); diff --git a/connections/implementation/mediums/webrtc/webrtc_socket_impl_test.cc b/connections/implementation/mediums/webrtc/webrtc_socket_impl_test.cc index af3b6d84..0be71e94 100644 --- a/connections/implementation/mediums/webrtc/webrtc_socket_impl_test.cc +++ b/connections/implementation/mediums/webrtc/webrtc_socket_impl_test.cc @@ -14,12 +14,14 @@ #include "connections/implementation/mediums/webrtc/webrtc_socket_impl.h" -#include +#include +#include #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" #include "internal/platform/byte_array.h" +#include "internal/platform/exception.h" #include "webrtc/api/data_channel_interface.h" namespace nearby { @@ -33,7 +35,7 @@ namespace { const char kSocketName[] = "TestSocket"; class MockDataChannel - : public rtc::RefCountedObject { + : public webrtc::RefCountedObject { public: MOCK_METHOD(void, RegisterObserver, (webrtc::DataChannelObserver*)); MOCK_METHOD(void, UnregisterObserver, ()); @@ -59,7 +61,8 @@ class MockDataChannel TEST(WebRtcSocketTest, ReadFromSocket) { const char* message = "message"; - rtc::scoped_refptr mock_data_channel(new MockDataChannel()); + webrtc::scoped_refptr mock_data_channel( + new MockDataChannel()); WebRtcSocket webrtc_socket(kSocketName, mock_data_channel); webrtc_socket.OnMessage(webrtc::DataBuffer{message}); @@ -69,7 +72,8 @@ TEST(WebRtcSocketTest, ReadFromSocket) { } TEST(WebRtcSocketTest, ReadMultipleMessages) { - rtc::scoped_refptr mock_data_channel(new MockDataChannel()); + webrtc::scoped_refptr mock_data_channel( + new MockDataChannel()); WebRtcSocket webrtc_socket(kSocketName, mock_data_channel); webrtc_socket.OnMessage(webrtc::DataBuffer{"Me"}); @@ -94,7 +98,8 @@ TEST(WebRtcSocketTest, ReadMultipleMessages) { TEST(WebRtcSocketTest, WriteToSocket) { const ByteArray kMessage{"Message"}; - rtc::scoped_refptr mock_data_channel(new MockDataChannel()); + webrtc::scoped_refptr mock_data_channel( + new MockDataChannel()); WebRtcSocket webrtc_socket(kSocketName, mock_data_channel); EXPECT_CALL(*mock_data_channel, Send(testing::_)) @@ -104,7 +109,8 @@ TEST(WebRtcSocketTest, WriteToSocket) { TEST(WebRtcSocketTest, SendDataBiggerThanMax) { const ByteArray kMessage{kMaxDataSize + 1}; - rtc::scoped_refptr mock_data_channel(new MockDataChannel()); + webrtc::scoped_refptr mock_data_channel( + new MockDataChannel()); WebRtcSocket webrtc_socket(kSocketName, mock_data_channel); EXPECT_CALL(*mock_data_channel, Send(testing::_)).Times(0); @@ -114,7 +120,8 @@ TEST(WebRtcSocketTest, SendDataBiggerThanMax) { TEST(WebRtcSocketTest, WriteToDataChannelFails) { ByteArray kMessage{"Message"}; - rtc::scoped_refptr mock_data_channel(new MockDataChannel()); + webrtc::scoped_refptr mock_data_channel( + new MockDataChannel()); WebRtcSocket webrtc_socket(kSocketName, mock_data_channel); ON_CALL(*mock_data_channel, Send(testing::_)) @@ -124,7 +131,8 @@ TEST(WebRtcSocketTest, WriteToDataChannelFails) { } TEST(WebRtcSocketTest, Close) { - rtc::scoped_refptr mock_data_channel(new MockDataChannel()); + webrtc::scoped_refptr mock_data_channel( + new MockDataChannel()); WebRtcSocket webrtc_socket(kSocketName, mock_data_channel); EXPECT_CALL(*mock_data_channel, Close()); @@ -149,7 +157,8 @@ TEST(WebRtcSocketTest, Close) { TEST(WebRtcSocketTest, WriteOnClosedChannel) { ByteArray kMessage{"Message"}; - rtc::scoped_refptr mock_data_channel(new MockDataChannel()); + webrtc::scoped_refptr mock_data_channel( + new MockDataChannel()); WebRtcSocket webrtc_socket(kSocketName, mock_data_channel); webrtc_socket.Close(); @@ -160,7 +169,8 @@ TEST(WebRtcSocketTest, WriteOnClosedChannel) { TEST(WebRtcSocketTest, ReadFromClosedChannel) { ByteArray kMessage{"Message"}; - rtc::scoped_refptr mock_data_channel(new MockDataChannel()); + webrtc::scoped_refptr mock_data_channel( + new MockDataChannel()); WebRtcSocket webrtc_socket(kSocketName, mock_data_channel); ON_CALL(*mock_data_channel, Send(testing::_)) .WillByDefault(testing::Return(true)); @@ -172,7 +182,8 @@ TEST(WebRtcSocketTest, ReadFromClosedChannel) { } TEST(WebRtcSocketTest, DataChannelCloseEventCleansUp) { - rtc::scoped_refptr mock_data_channel(new MockDataChannel()); + webrtc::scoped_refptr mock_data_channel( + new MockDataChannel()); WebRtcSocket webrtc_socket(kSocketName, mock_data_channel); ON_CALL(*mock_data_channel, state()) @@ -189,7 +200,8 @@ TEST(WebRtcSocketTest, DataChannelCloseEventCleansUp) { } TEST(WebRtcSocketTest, OpenStateTriggersCallback) { - rtc::scoped_refptr mock_data_channel(new MockDataChannel()); + webrtc::scoped_refptr mock_data_channel( + new MockDataChannel()); WebRtcSocket webrtc_socket(kSocketName, mock_data_channel); int socket_ready_cb_called = 0; @@ -209,7 +221,8 @@ TEST(WebRtcSocketTest, OpenStateTriggersCallback) { } TEST(WebRtcSocketTest, CloseStateTriggersCallback) { - rtc::scoped_refptr mock_data_channel(new MockDataChannel()); + webrtc::scoped_refptr mock_data_channel( + new MockDataChannel()); WebRtcSocket webrtc_socket(kSocketName, mock_data_channel); int socket_closed_cb_called = 0; diff --git a/internal/platform/implementation/g3/webrtc.cc b/internal/platform/implementation/g3/webrtc.cc index 02d692c1..5c833366 100644 --- a/internal/platform/implementation/g3/webrtc.cc +++ b/internal/platform/implementation/g3/webrtc.cc @@ -80,7 +80,7 @@ void WebRtcMedium::CreatePeerConnection( rtc_config.sdp_semantics = webrtc::SdpSemantics::kUnifiedPlan; webrtc::PeerConnectionDependencies dependencies(observer); - std::unique_ptr signaling_thread = rtc::Thread::Create(); + std::unique_ptr signaling_thread = webrtc::Thread::Create(); signaling_thread->SetName("signaling_thread", nullptr); RTC_CHECK(signaling_thread->Start()) << "Failed to start thread"; @@ -89,7 +89,7 @@ void WebRtcMedium::CreatePeerConnection( webrtc::CreateDefaultTaskQueueFactory(); factory_dependencies.signaling_thread = signaling_thread.release(); - rtc::scoped_refptr + webrtc::scoped_refptr peer_connection_factory = webrtc::CreateModularPeerConnectionFactory( std::move(factory_dependencies)); RTC_CHECK(peer_connection_factory != nullptr) diff --git a/internal/platform/implementation/webrtc.h b/internal/platform/implementation/webrtc.h index 820348b7..39fd92a2 100644 --- a/internal/platform/implementation/webrtc.h +++ b/internal/platform/implementation/webrtc.h @@ -49,7 +49,7 @@ class WebRtcSignalingMessenger { class WebRtcMedium { public: using PeerConnectionCallback = absl::AnyInvocable)>; + webrtc::scoped_refptr)>; virtual ~WebRtcMedium() = default; diff --git a/internal/platform/implementation/windows/webrtc.cc b/internal/platform/implementation/windows/webrtc.cc index 287b4898..bea4138a 100644 --- a/internal/platform/implementation/windows/webrtc.cc +++ b/internal/platform/implementation/windows/webrtc.cc @@ -90,7 +90,7 @@ void WebRtcMedium::CreatePeerConnection( ice_server.urls.emplace_back("stun:stun4.l.google.com:19302"); rtc_config.servers.push_back(ice_server); - std::unique_ptr signaling_thread = rtc::Thread::Create(); + std::unique_ptr signaling_thread = webrtc::Thread::Create(); signaling_thread->SetName("signaling_thread", nullptr); if (!signaling_thread->Start()) { LOG(FATAL) << "Failed to start thread"; @@ -102,7 +102,7 @@ void WebRtcMedium::CreatePeerConnection( webrtc::CreateDefaultTaskQueueFactory(); factory_dependencies.signaling_thread = signaling_thread.release(); - rtc::scoped_refptr + webrtc::scoped_refptr peer_connection_factory = webrtc::CreateModularPeerConnectionFactory( std::move(factory_dependencies)); if (options.has_value()) { diff --git a/internal/platform/implementation/windows/webrtc_test.cc b/internal/platform/implementation/windows/webrtc_test.cc index 5b1e5c50..d41f50db 100644 --- a/internal/platform/implementation/windows/webrtc_test.cc +++ b/internal/platform/implementation/windows/webrtc_test.cc @@ -34,8 +34,8 @@ class MockPeerConnectionObserver : public webrtc::PeerConnectionObserver { void OnSignalingChange( webrtc::PeerConnectionInterface::SignalingState new_state) override {} - void OnDataChannel( - rtc::scoped_refptr data_channel) override {} + void OnDataChannel(webrtc::scoped_refptr + data_channel) override {} void OnIceGatheringChange( webrtc::PeerConnectionInterface::IceGatheringState new_state) override {} @@ -64,7 +64,7 @@ TEST(WebrtcTest, CreatePeerConnectionSucceeds) { WebRtcMedium medium; medium.CreatePeerConnection( std::nullopt, observer.get(), - [](rtc::scoped_refptr + [](webrtc::scoped_refptr peer_connection) mutable { if (!peer_connection) { FAIL() << "Peer connection should have been non-null"; diff --git a/internal/platform/webrtc.h b/internal/platform/webrtc.h index 0b6463b1..6620521e 100644 --- a/internal/platform/webrtc.h +++ b/internal/platform/webrtc.h @@ -92,7 +92,7 @@ class WebRtcMedium { .GetFlags() .support_web_rtc_non_cellular_medium && non_cellular_) { std::optional options; - options->network_ignore_mask |= rtc::ADAPTER_TYPE_CELLULAR; + options->network_ignore_mask |= webrtc::ADAPTER_TYPE_CELLULAR; impl_->CreatePeerConnection(options, observer, std::move(callback)); } else { impl_->CreatePeerConnection(observer, std::move(callback));