summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/p2p/client
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /third_party/libwebrtc/p2p/client
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--third_party/libwebrtc/p2p/client/basic_port_allocator.cc35
-rw-r--r--third_party/libwebrtc/p2p/client/basic_port_allocator.h3
-rw-r--r--third_party/libwebrtc/p2p/client/basic_port_allocator_unittest.cc28
3 files changed, 16 insertions, 50 deletions
diff --git a/third_party/libwebrtc/p2p/client/basic_port_allocator.cc b/third_party/libwebrtc/p2p/client/basic_port_allocator.cc
index e8255f1fd5..e95033efeb 100644
--- a/third_party/libwebrtc/p2p/client/basic_port_allocator.cc
+++ b/third_party/libwebrtc/p2p/client/basic_port_allocator.cc
@@ -126,11 +126,15 @@ bool IsAllowedByCandidateFilter(const Candidate& c, uint32_t filter) {
return false;
}
- if (c.type() == RELAY_PORT_TYPE) {
+ if (c.is_relay()) {
return ((filter & CF_RELAY) != 0);
- } else if (c.type() == STUN_PORT_TYPE) {
+ }
+
+ if (c.is_stun()) {
return ((filter & CF_REFLEXIVE) != 0);
- } else if (c.type() == LOCAL_PORT_TYPE) {
+ }
+
+ if (c.is_local()) {
if ((filter & CF_REFLEXIVE) && !c.address().IsPrivateIP()) {
// We allow host candidates if the filter allows server-reflexive
// candidates and the candidate is a public IP. Because we don't generate
@@ -143,6 +147,7 @@ bool IsAllowedByCandidateFilter(const Candidate& c, uint32_t filter) {
return ((filter & CF_HOST) != 0);
}
+
return false;
}
@@ -199,21 +204,6 @@ BasicPortAllocator::BasicPortAllocator(
webrtc::NO_PRUNE, nullptr);
}
-void BasicPortAllocator::OnIceRegathering(PortAllocatorSession* session,
- IceRegatheringReason reason) {
- // If the session has not been taken by an active channel, do not report the
- // metric.
- for (auto& allocator_session : pooled_sessions()) {
- if (allocator_session.get() == session) {
- return;
- }
- }
-
- RTC_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.IceRegatheringReason",
- static_cast<int>(reason),
- static_cast<int>(IceRegatheringReason::MAX_VALUE));
-}
-
BasicPortAllocator::~BasicPortAllocator() {
CheckRunOnValidThreadIfInitialized();
// Our created port allocator sessions depend on us, so destroy our remaining
@@ -251,12 +241,9 @@ PortAllocatorSession* BasicPortAllocator::CreateSessionInternal(
absl::string_view ice_ufrag,
absl::string_view ice_pwd) {
CheckRunOnValidThreadAndInitialized();
- PortAllocatorSession* session = new BasicPortAllocatorSession(
- this, std::string(content_name), component, std::string(ice_ufrag),
- std::string(ice_pwd));
- session->SignalIceRegathering.connect(this,
- &BasicPortAllocator::OnIceRegathering);
- return session;
+ return new BasicPortAllocatorSession(this, std::string(content_name),
+ component, std::string(ice_ufrag),
+ std::string(ice_pwd));
}
void BasicPortAllocator::AddTurnServerForTesting(
diff --git a/third_party/libwebrtc/p2p/client/basic_port_allocator.h b/third_party/libwebrtc/p2p/client/basic_port_allocator.h
index 643904ab27..25201fd016 100644
--- a/third_party/libwebrtc/p2p/client/basic_port_allocator.h
+++ b/third_party/libwebrtc/p2p/client/basic_port_allocator.h
@@ -85,9 +85,6 @@ class RTC_EXPORT BasicPortAllocator : public PortAllocator {
}
private:
- void OnIceRegathering(PortAllocatorSession* session,
- IceRegatheringReason reason);
-
bool MdnsObfuscationEnabled() const override;
webrtc::AlwaysValidPointer<const webrtc::FieldTrialsView,
diff --git a/third_party/libwebrtc/p2p/client/basic_port_allocator_unittest.cc b/third_party/libwebrtc/p2p/client/basic_port_allocator_unittest.cc
index defcab01c9..0c3bf6bc23 100644
--- a/third_party/libwebrtc/p2p/client/basic_port_allocator_unittest.cc
+++ b/third_party/libwebrtc/p2p/client/basic_port_allocator_unittest.cc
@@ -496,8 +496,8 @@ class BasicPortAllocatorTestBase : public ::testing::Test,
bool with_nat) {
if (with_nat) {
nat_server_.reset(new rtc::NATServer(
- rtc::NAT_OPEN_CONE, vss_.get(), kNatUdpAddr, kNatTcpAddr, vss_.get(),
- rtc::SocketAddress(kNatUdpAddr.ipaddr(), 0)));
+ rtc::NAT_OPEN_CONE, thread_, vss_.get(), kNatUdpAddr, kNatTcpAddr,
+ thread_, vss_.get(), rtc::SocketAddress(kNatUdpAddr.ipaddr(), 0)));
} else {
nat_socket_factory_ =
std::make_unique<rtc::BasicPacketSocketFactory>(fss_.get());
@@ -2390,24 +2390,6 @@ TEST_F(BasicPortAllocatorTest,
expected_stun_keepalive_interval);
}
-TEST_F(BasicPortAllocatorTest, IceRegatheringMetricsLoggedWhenNetworkChanges) {
- // Only test local ports to simplify test.
- ResetWithNoServersOrNat();
- AddInterface(kClientAddr, "test_net0");
- ASSERT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
- session_->StartGettingPorts();
- EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
- kDefaultAllocationTimeout, fake_clock);
- candidate_allocation_done_ = false;
- AddInterface(kClientAddr2, "test_net1");
- EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
- kDefaultAllocationTimeout, fake_clock);
- EXPECT_METRIC_EQ(1,
- webrtc::metrics::NumEvents(
- "WebRTC.PeerConnection.IceRegatheringReason",
- static_cast<int>(IceRegatheringReason::NETWORK_CHANGE)));
-}
-
// Test that when an mDNS responder is present, the local address of a host
// candidate is concealed by an mDNS hostname and the related address of a srflx
// candidate is set to 0.0.0.0 or ::0.
@@ -2435,7 +2417,7 @@ TEST_F(BasicPortAllocatorTest, HostCandidateAddressIsReplacedByHostname) {
for (const auto& candidate : candidates_) {
const auto& raddr = candidate.related_address();
- if (candidate.type() == LOCAL_PORT_TYPE) {
+ if (candidate.is_local()) {
EXPECT_FALSE(candidate.address().hostname().empty());
EXPECT_TRUE(raddr.IsNil());
if (candidate.protocol() == UDP_PROTOCOL_NAME) {
@@ -2443,13 +2425,13 @@ TEST_F(BasicPortAllocatorTest, HostCandidateAddressIsReplacedByHostname) {
} else {
++num_host_tcp_candidates;
}
- } else if (candidate.type() == STUN_PORT_TYPE) {
+ } else if (candidate.is_stun()) {
// For a srflx candidate, the related address should be set to 0.0.0.0 or
// ::0
EXPECT_TRUE(IPIsAny(raddr.ipaddr()));
EXPECT_EQ(raddr.port(), 0);
++num_srflx_candidates;
- } else if (candidate.type() == RELAY_PORT_TYPE) {
+ } else if (candidate.is_relay()) {
EXPECT_EQ(kNatUdpAddr.ipaddr(), raddr.ipaddr());
EXPECT_EQ(kNatUdpAddr.family(), raddr.family());
++num_relay_candidates;