diff --git a/api/peer_connection_interface.h b/api/peer_connection_interface.h index 2ae290c8d6..cc37dabd65 100644 --- a/api/peer_connection_interface.h +++ b/api/peer_connection_interface.h @@ -570,12 +570,6 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface { // binding requests to keep NAT bindings open. absl::optional stun_candidate_keepalive_interval; - // ICE Periodic Regathering - // If set, WebRTC will periodically create and propose candidates without - // starting a new ICE generation. The regathering happens continuously with - // interval specified in milliseconds by the uniform distribution [a, b]. - absl::optional ice_regather_interval_range; - // Optional TurnCustomizer. // With this class one can modify outgoing TURN messages. // The object passed in must remain valid until PeerConnection::Close() is diff --git a/p2p/base/connection.cc b/p2p/base/connection.cc index f3692c5cc0..e50390901f 100644 --- a/p2p/base/connection.cc +++ b/p2p/base/connection.cc @@ -30,6 +30,7 @@ #include "rtc_base/numerics/safe_minmax.h" #include "rtc_base/string_encode.h" #include "rtc_base/string_utils.h" +#include "rtc_base/strings/string_builder.h" #include "rtc_base/third_party/base64/base64.h" #include "system_wrappers/include/field_trial.h" diff --git a/p2p/base/fake_port_allocator.h b/p2p/base/fake_port_allocator.h index 4fafb542b3..266bb7956b 100644 --- a/p2p/base/fake_port_allocator.h +++ b/p2p/base/fake_port_allocator.h @@ -132,10 +132,6 @@ class FakePortAllocatorSession : public PortAllocatorSession { void ClearGettingPorts() override { is_cleared = true; } bool IsCleared() const override { return is_cleared; } - void RegatherOnAllNetworks() override { - SignalIceRegathering(this, IceRegatheringReason::OCCASIONAL_REFRESH); - } - void RegatherOnFailedNetworks() override { SignalIceRegathering(this, IceRegatheringReason::NETWORK_FAILURE); } diff --git a/p2p/base/ice_transport_internal.h b/p2p/base/ice_transport_internal.h index 94b5b194ff..b735a1a742 100644 --- a/p2p/base/ice_transport_internal.h +++ b/p2p/base/ice_transport_internal.h @@ -112,10 +112,6 @@ struct IceConfig { // active network having no connection on it. absl::optional regather_on_failed_networks_interval; - // Interval to perform ICE regathering on all networks - // The delay in milliseconds is sampled from the uniform distribution [a, b] - absl::optional regather_all_networks_interval_range; - // The time period in which we will not switch the selected connection // when a new connection becomes receiving but the selected connection is not // in case that the selected connection may become receiving soon. diff --git a/p2p/base/p2p_transport_channel.cc b/p2p/base/p2p_transport_channel.cc index 75490ee9d7..4e18cd43cb 100644 --- a/p2p/base/p2p_transport_channel.cc +++ b/p2p/base/p2p_transport_channel.cc @@ -116,9 +116,9 @@ P2PTransportChannel::P2PTransportChannel( // Validate IceConfig even for mostly built-in constant default values in case // we change them. RTC_DCHECK(ValidateIceConfig(config_).ok()); - webrtc::BasicRegatheringController::Config regathering_config( - config_.regather_all_networks_interval_range, - config_.regather_on_failed_networks_interval_or_default()); + webrtc::BasicRegatheringController::Config regathering_config; + regathering_config.regather_on_failed_networks_interval = + config_.regather_on_failed_networks_interval_or_default(); regathering_controller_ = std::make_unique( regathering_config, this, network_thread_); @@ -538,18 +538,6 @@ void P2PTransportChannel::SetIceConfig(const IceConfig& config) { << config_.regather_on_failed_networks_interval_or_default(); } - if (config_.regather_all_networks_interval_range != - config.regather_all_networks_interval_range) { - // Config validation is assumed to have already happened at the API layer. - RTC_DCHECK(config.continual_gathering_policy != GATHER_ONCE); - config_.regather_all_networks_interval_range = - config.regather_all_networks_interval_range; - RTC_LOG(LS_INFO) << "Set regather_all_networks_interval_range to " - << config.regather_all_networks_interval_range - .value_or(rtc::IntervalRange(-1, 0)) - .ToString(); - } - if (config_.receiving_switching_delay != config.receiving_switching_delay) { config_.receiving_switching_delay = config.receiving_switching_delay; RTC_LOG(LS_INFO) << "Set receiving_switching_delay to " @@ -678,9 +666,9 @@ void P2PTransportChannel::SetIceConfig(const IceConfig& config) { << *field_trials_.initial_select_dampening_ping_received; } - webrtc::BasicRegatheringController::Config regathering_config( - config_.regather_all_networks_interval_range, - config_.regather_on_failed_networks_interval_or_default()); + webrtc::BasicRegatheringController::Config regathering_config; + regathering_config.regather_on_failed_networks_interval = + config_.regather_on_failed_networks_interval_or_default(); regathering_controller_->SetConfig(regathering_config); ice_controller_->SetIceConfig(config_); @@ -697,13 +685,6 @@ const IceConfig& P2PTransportChannel::config() const { // PeerConnection::SetConfiguration. // Static RTCError P2PTransportChannel::ValidateIceConfig(const IceConfig& config) { - if (config.regather_all_networks_interval_range && - config.continual_gathering_policy == GATHER_ONCE) { - return RTCError(RTCErrorType::INVALID_PARAMETER, - "regather_all_networks_interval_range specified but " - "continual gathering policy is GATHER_ONCE"); - } - if (config.ice_check_interval_strong_connectivity_or_default() < config.ice_check_interval_weak_connectivity.value_or( GetWeakPingIntervalInFieldTrial())) { @@ -744,13 +725,6 @@ RTCError P2PTransportChannel::ValidateIceConfig(const IceConfig& config) { "UNRELIABLE is longer than that to become TIMEOUT."); } - if (config.regather_all_networks_interval_range && - config.regather_all_networks_interval_range.value().min() < 0) { - return RTCError( - RTCErrorType::INVALID_RANGE, - "The minimum regathering interval for all networks is negative."); - } - return RTCError::OK(); } diff --git a/p2p/base/p2p_transport_channel_unittest.cc b/p2p/base/p2p_transport_channel_unittest.cc index 972f7b394b..5f84aa3cf1 100644 --- a/p2p/base/p2p_transport_channel_unittest.cc +++ b/p2p/base/p2p_transport_channel_unittest.cc @@ -1464,101 +1464,6 @@ TEST_F(P2PTransportChannelTest, DestroyChannels(); } -// Tests that ICE regathering occurs regularly when -// regather_all_networks_interval_range configuration value is set. -TEST_F(P2PTransportChannelTest, TestIceRegatherOnAllNetworksContinual) { - rtc::ScopedFakeClock clock; - ConfigureEndpoints(OPEN, OPEN, kOnlyLocalPorts, kOnlyLocalPorts); - - // ep1 gathers continually but ep2 does not. - const int kRegatherInterval = 2000; - IceConfig config1 = CreateIceConfig(1000, GATHER_CONTINUALLY); - config1.regather_all_networks_interval_range.emplace(kRegatherInterval, - kRegatherInterval); - IceConfig config2; - CreateChannels(config1, config2); - - EXPECT_TRUE_SIMULATED_WAIT(CheckConnected(ep1_ch1(), ep2_ch1()), - kDefaultTimeout, clock); - - fw()->AddRule(false, rtc::FP_ANY, rtc::FD_ANY, kPublicAddrs[0]); - // Timeout value such that all connections are deleted. - const int kNetworkGatherDuration = 11000; - SIMULATED_WAIT(false, kNetworkGatherDuration, clock); - // Expect regathering to happen 5 times in 11s with 2s interval. - EXPECT_LE(5, GetEndpoint(0)->GetIceRegatheringCountForReason( - IceRegatheringReason::OCCASIONAL_REFRESH)); - EXPECT_METRIC_LE( - 5, webrtc::metrics::NumEvents( - "WebRTC.PeerConnection.IceRegatheringReason", - static_cast(IceRegatheringReason::OCCASIONAL_REFRESH))); - // Expect no regathering if continual gathering not configured. - EXPECT_EQ(0, GetEndpoint(1)->GetIceRegatheringCountForReason( - IceRegatheringReason::OCCASIONAL_REFRESH)); - - DestroyChannels(); -} - -// Test that ICE periodic regathering can change the selected connection on the -// specified interval and that the peers can communicate over the new -// connection. The test is parameterized to test that it works when regathering -// is done by the ICE controlling peer and when done by the controlled peer. -class P2PTransportRegatherAllNetworksTest : public P2PTransportChannelTest { - protected: - void TestWithRoles(IceRole p1_role, IceRole p2_role) { - rtc::ScopedFakeClock clock; - ConfigureEndpoints(NAT_SYMMETRIC, NAT_SYMMETRIC, kDefaultPortAllocatorFlags, - kDefaultPortAllocatorFlags); - set_force_relay(true); - - const int kRegatherInterval = 2000; - const int kNumRegathers = 2; - - // Set up peer 1 to auto regather every 2s. - IceConfig config1 = CreateIceConfig(1000, GATHER_CONTINUALLY); - config1.regather_all_networks_interval_range.emplace(kRegatherInterval, - kRegatherInterval); - IceConfig config2 = CreateIceConfig(1000, GATHER_CONTINUALLY); - - // Set peer roles. - SetIceRole(0, p1_role); - SetIceRole(1, p2_role); - - CreateChannels(config1, config2); - - // Wait for initial connection to be made. - EXPECT_TRUE_SIMULATED_WAIT(CheckConnected(ep1_ch1(), ep2_ch1()), - kMediumTimeout, clock); - - const Connection* initial_selected = ep1_ch1()->selected_connection(); - - // Wait long enough for 2 regathering cycles to happen plus some extra so - // the new connection has time to settle. - const int kWaitRegather = - kRegatherInterval * kNumRegathers + kRegatherInterval / 2; - SIMULATED_WAIT(false, kWaitRegather, clock); - EXPECT_EQ(kNumRegathers, GetEndpoint(0)->GetIceRegatheringCountForReason( - IceRegatheringReason::OCCASIONAL_REFRESH)); - - const Connection* new_selected = ep1_ch1()->selected_connection(); - - // Want the new selected connection to be different. - ASSERT_NE(initial_selected, new_selected); - - // Make sure we can communicate over the new connection too. - TestSendRecv(&clock); - DestroyChannels(); - } -}; - -TEST_F(P2PTransportRegatherAllNetworksTest, TestControlling) { - TestWithRoles(ICEROLE_CONTROLLING, ICEROLE_CONTROLLED); -} - -TEST_F(P2PTransportRegatherAllNetworksTest, TestControlled) { - TestWithRoles(ICEROLE_CONTROLLED, ICEROLE_CONTROLLING); -} - // Test that we properly create a connection on a STUN ping from unknown address // when the signaling is slow. TEST_F(P2PTransportChannelTest, PeerReflexiveCandidateBeforeSignaling) { diff --git a/p2p/base/port.cc b/p2p/base/port.cc index dbc04a484b..a6eb333923 100644 --- a/p2p/base/port.cc +++ b/p2p/base/port.cc @@ -31,6 +31,7 @@ #include "rtc_base/numerics/safe_minmax.h" #include "rtc_base/string_encode.h" #include "rtc_base/string_utils.h" +#include "rtc_base/strings/string_builder.h" #include "rtc_base/third_party/base64/base64.h" #include "system_wrappers/include/field_trial.h" diff --git a/p2p/base/port_allocator.h b/p2p/base/port_allocator.h index 2fe8db2c97..4bbe56c0b5 100644 --- a/p2p/base/port_allocator.h +++ b/p2p/base/port_allocator.h @@ -240,8 +240,6 @@ class RTC_EXPORT PortAllocatorSession : public sigslot::has_slots<> { // network. Only if all networks of an interface have no connection, the // implementation should start re-gathering on all networks of that interface. virtual void RegatherOnFailedNetworks() {} - // Re-gathers candidates on all networks. - virtual void RegatherOnAllNetworks() {} // Get candidate-level stats from all candidates on the ready ports and return // the stats to the given list. virtual void GetCandidateStatsFromReadyPorts( diff --git a/p2p/base/regathering_controller.cc b/p2p/base/regathering_controller.cc index a4d21eb079..fe38a3e4d4 100644 --- a/p2p/base/regathering_controller.cc +++ b/p2p/base/regathering_controller.cc @@ -12,29 +12,11 @@ namespace webrtc { -using Config = BasicRegatheringController::Config; - -Config::Config(const absl::optional& - regather_on_all_networks_interval_range, - int regather_on_failed_networks_interval) - : regather_on_all_networks_interval_range( - regather_on_all_networks_interval_range), - regather_on_failed_networks_interval( - regather_on_failed_networks_interval) {} - -Config::Config(const Config& other) = default; - -Config::~Config() = default; -Config& Config::operator=(const Config& other) = default; - BasicRegatheringController::BasicRegatheringController( const Config& config, cricket::IceTransportInternal* ice_transport, rtc::Thread* thread) - : config_(config), - ice_transport_(ice_transport), - thread_(thread), - rand_(rtc::SystemTimeNanos()) { + : config_(config), ice_transport_(ice_transport), thread_(thread) { RTC_DCHECK(ice_transport_); RTC_DCHECK(thread_); ice_transport_->SignalStateChanged.connect( @@ -51,96 +33,41 @@ BasicRegatheringController::~BasicRegatheringController() = default; void BasicRegatheringController::Start() { ScheduleRecurringRegatheringOnFailedNetworks(); - if (config_.regather_on_all_networks_interval_range) { - ScheduleRecurringRegatheringOnAllNetworks(); - } } void BasicRegatheringController::SetConfig(const Config& config) { - bool need_cancel_on_all_networks = - has_recurring_schedule_on_all_networks_ && - (config_.regather_on_all_networks_interval_range != - config.regather_on_all_networks_interval_range); - bool need_reschedule_on_all_networks = - config.regather_on_all_networks_interval_range && - (config_.regather_on_all_networks_interval_range != - config.regather_on_all_networks_interval_range); bool need_cancel_and_reschedule_on_failed_networks = has_recurring_schedule_on_failed_networks_ && (config_.regather_on_failed_networks_interval != config.regather_on_failed_networks_interval); config_ = config; - if (need_cancel_on_all_networks) { - CancelScheduledRecurringRegatheringOnAllNetworks(); - } - if (need_reschedule_on_all_networks) { - ScheduleRecurringRegatheringOnAllNetworks(); - } if (need_cancel_and_reschedule_on_failed_networks) { CancelScheduledRecurringRegatheringOnFailedNetworks(); ScheduleRecurringRegatheringOnFailedNetworks(); } } -void BasicRegatheringController::ScheduleRecurringRegatheringOnAllNetworks() { - RTC_DCHECK(config_.regather_on_all_networks_interval_range && - config_.regather_on_all_networks_interval_range.value().min() >= - 0); - int delay_ms = SampleRegatherAllNetworksInterval( - config_.regather_on_all_networks_interval_range.value()); - CancelScheduledRecurringRegatheringOnAllNetworks(); - has_recurring_schedule_on_all_networks_ = true; - invoker_for_all_networks_.AsyncInvokeDelayed( - RTC_FROM_HERE, thread(), - rtc::Bind( - &BasicRegatheringController::RegatherOnAllNetworksIfDoneGathering, - this, true), - delay_ms); -} - -void BasicRegatheringController::RegatherOnAllNetworksIfDoneGathering( - bool repeated) { - // Only regather when the current session is in the CLEARED state (i.e., not - // running or stopped). It is only possible to enter this state when we gather - // continually, so there is an implicit check on continual gathering here. - if (allocator_session_ && allocator_session_->IsCleared()) { - allocator_session_->RegatherOnAllNetworks(); - } - if (repeated) { - ScheduleRecurringRegatheringOnAllNetworks(); - } -} - void BasicRegatheringController:: ScheduleRecurringRegatheringOnFailedNetworks() { RTC_DCHECK(config_.regather_on_failed_networks_interval >= 0); CancelScheduledRecurringRegatheringOnFailedNetworks(); has_recurring_schedule_on_failed_networks_ = true; invoker_for_failed_networks_.AsyncInvokeDelayed( - RTC_FROM_HERE, thread(), + RTC_FROM_HERE, thread_, rtc::Bind( &BasicRegatheringController::RegatherOnFailedNetworksIfDoneGathering, - this, true), + this), config_.regather_on_failed_networks_interval); } -void BasicRegatheringController::RegatherOnFailedNetworksIfDoneGathering( - bool repeated) { +void BasicRegatheringController::RegatherOnFailedNetworksIfDoneGathering() { // Only regather when the current session is in the CLEARED state (i.e., not // running or stopped). It is only possible to enter this state when we gather // continually, so there is an implicit check on continual gathering here. if (allocator_session_ && allocator_session_->IsCleared()) { allocator_session_->RegatherOnFailedNetworks(); } - if (repeated) { - ScheduleRecurringRegatheringOnFailedNetworks(); - } -} - -void BasicRegatheringController:: - CancelScheduledRecurringRegatheringOnAllNetworks() { - invoker_for_all_networks_.Clear(); - has_recurring_schedule_on_all_networks_ = false; + ScheduleRecurringRegatheringOnFailedNetworks(); } void BasicRegatheringController:: @@ -149,9 +76,4 @@ void BasicRegatheringController:: has_recurring_schedule_on_failed_networks_ = false; } -int BasicRegatheringController::SampleRegatherAllNetworksInterval( - const rtc::IntervalRange& range) { - return rand_.Rand(range.min(), range.max()); -} - } // namespace webrtc diff --git a/p2p/base/regathering_controller.h b/p2p/base/regathering_controller.h index 234aea3b57..54a76dc3e5 100644 --- a/p2p/base/regathering_controller.h +++ b/p2p/base/regathering_controller.h @@ -14,7 +14,6 @@ #include "p2p/base/ice_transport_internal.h" #include "p2p/base/port_allocator.h" #include "rtc_base/async_invoker.h" -#include "rtc_base/random.h" #include "rtc_base/thread.h" namespace webrtc { @@ -22,12 +21,9 @@ namespace webrtc { // Controls regathering of candidates for the ICE transport passed into it, // reacting to signals like SignalWritableState, SignalNetworkRouteChange, etc., // using methods like GetStats to get additional information, and calling -// methods like RegatherOnAllNetworks on the PortAllocatorSession when +// methods like RegatherOnFailedNetworks on the PortAllocatorSession when // regathering is desired. // -// TODO(qingsi): Add the description of behavior when autonomous regathering is -// implemented. -// // "Regathering" is defined as gathering additional candidates within a single // ICE generation (or in other words, PortAllocatorSession), and is possible // when "continual gathering" is enabled. This may allow connectivity to be @@ -46,14 +42,8 @@ namespace webrtc { class BasicRegatheringController : public sigslot::has_slots<> { public: struct Config { - Config(const absl::optional& - regather_on_all_networks_interval_range, - int regather_on_failed_networks_interval); - Config(const Config& other); - ~Config(); - Config& operator=(const Config& other); - absl::optional regather_on_all_networks_interval_range; - int regather_on_failed_networks_interval; + int regather_on_failed_networks_interval = + cricket::REGATHER_ON_FAILED_NETWORKS_INTERVAL; }; BasicRegatheringController() = delete; @@ -83,11 +73,6 @@ class BasicRegatheringController : public sigslot::has_slots<> { void OnIceTransportWritableState(rtc::PacketTransportInternal*) {} void OnIceTransportReceivingState(rtc::PacketTransportInternal*) {} void OnIceTransportNetworkRouteChanged(absl::optional) {} - // Schedules delayed and repeated regathering of local candidates on all - // networks, where the delay in milliseconds is randomly sampled from the - // range in the config. The delay of each repetition is independently sampled - // from the same range. When scheduled, all previous schedules are canceled. - void ScheduleRecurringRegatheringOnAllNetworks(); // Schedules delayed and repeated regathering of local candidates on failed // networks, where the delay in milliseconds is given by the config. Each // repetition is separated by the same delay. When scheduled, all previous @@ -99,24 +84,16 @@ class BasicRegatheringController : public sigslot::has_slots<> { // ScheduleRecurringRegatheringOnFailedNetworks. void CancelScheduledRecurringRegatheringOnFailedNetworks(); - rtc::Thread* thread() const { return thread_; } - // The following two methods perform the actual regathering, if the recent - // port allocator session has done the initial gathering. - void RegatherOnAllNetworksIfDoneGathering(bool repeated); - void RegatherOnFailedNetworksIfDoneGathering(bool repeated); - // Samples a delay from the uniform distribution in the given range. - int SampleRegatherAllNetworksInterval(const rtc::IntervalRange& range); + // The following method perform the actual regathering, if the recent port + // allocator session has done the initial gathering. + void RegatherOnFailedNetworksIfDoneGathering(); Config config_; cricket::IceTransportInternal* ice_transport_; cricket::PortAllocatorSession* allocator_session_ = nullptr; - bool has_recurring_schedule_on_all_networks_ = false; bool has_recurring_schedule_on_failed_networks_ = false; rtc::Thread* thread_; - rtc::AsyncInvoker invoker_for_all_networks_; rtc::AsyncInvoker invoker_for_failed_networks_; - // Used to generate random intervals for regather_all_networks_interval_range. - Random rand_; }; } // namespace webrtc diff --git a/p2p/base/regathering_controller_unittest.cc b/p2p/base/regathering_controller_unittest.cc index e9da576667..1617b92894 100644 --- a/p2p/base/regathering_controller_unittest.cc +++ b/p2p/base/regathering_controller_unittest.cc @@ -54,7 +54,8 @@ class RegatheringControllerTest : public ::testing::Test, ice_transport_(new cricket::MockIceTransport()), allocator_( new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr)) { - BasicRegatheringController::Config regathering_config(absl::nullopt, 0); + BasicRegatheringController::Config regathering_config; + regathering_config.regather_on_failed_networks_interval = 0; regathering_controller_.reset(new BasicRegatheringController( regathering_config, ice_transport_.get(), rtc::Thread::Current())); } @@ -121,15 +122,12 @@ TEST_F(RegatheringControllerTest, rtc::ScopedFakeClock clock; InitializeAndGatherOnce(); // Session not cleared. - rtc::IntervalRange regather_all_networks_interval_range(2000, 2000); - BasicRegatheringController::Config config( - regather_all_networks_interval_range, 2000); + BasicRegatheringController::Config config; + config.regather_on_failed_networks_interval = 2000; regathering_controller()->SetConfig(config); regathering_controller()->Start(); SIMULATED_WAIT(false, 10000, clock); // Expect no regathering in the last 10s. - EXPECT_EQ(0, GetRegatheringReasonCount( - cricket::IceRegatheringReason::OCCASIONAL_REFRESH)); EXPECT_EQ(0, GetRegatheringReasonCount( cricket::IceRegatheringReason::NETWORK_FAILURE)); } @@ -138,149 +136,25 @@ TEST_F(RegatheringControllerTest, IceRegatheringRepeatsAsScheduled) { rtc::ScopedFakeClock clock; InitializeAndGatherOnceWithSessionCleared(); - rtc::IntervalRange regather_all_networks_interval_range(2000, 2000); - BasicRegatheringController::Config config( - regather_all_networks_interval_range, 2000); + BasicRegatheringController::Config config; + config.regather_on_failed_networks_interval = 2000; regathering_controller()->SetConfig(config); regathering_controller()->Start(); SIMULATED_WAIT(false, 2000 - 1, clock); // Expect no regathering. - EXPECT_EQ(0, GetRegatheringReasonCount( - cricket::IceRegatheringReason::OCCASIONAL_REFRESH)); EXPECT_EQ(0, GetRegatheringReasonCount( cricket::IceRegatheringReason::NETWORK_FAILURE)); SIMULATED_WAIT(false, 2, clock); // Expect regathering on all networks and on failed networks to happen once // respectively in that last 2s with 2s interval. - EXPECT_EQ(1, GetRegatheringReasonCount( - cricket::IceRegatheringReason::OCCASIONAL_REFRESH)); EXPECT_EQ(1, GetRegatheringReasonCount( cricket::IceRegatheringReason::NETWORK_FAILURE)); SIMULATED_WAIT(false, 11000, clock); // Expect regathering to happen for another 5 times in 11s with 2s interval. - EXPECT_EQ(6, GetRegatheringReasonCount( - cricket::IceRegatheringReason::OCCASIONAL_REFRESH)); EXPECT_EQ(6, GetRegatheringReasonCount( cricket::IceRegatheringReason::NETWORK_FAILURE)); } -// Tests that the schedule of ICE regathering on all networks can be started -// when not scheduled initially. -TEST_F(RegatheringControllerTest, - IceRegatheringOnAllNetworksCanBeScheduledAfterStart) { - rtc::ScopedFakeClock clock; - InitializeAndGatherOnceWithSessionCleared(); - - BasicRegatheringController::Config config(absl::nullopt, 2000); - regathering_controller()->SetConfig(config); - regathering_controller()->Start(); - SIMULATED_WAIT(false, 3000, clock); - // Expect no regathering on all networks. - EXPECT_EQ(0, GetRegatheringReasonCount( - cricket::IceRegatheringReason::OCCASIONAL_REFRESH)); - config.regather_on_all_networks_interval_range = - rtc::IntervalRange(2000, 2000); - regathering_controller()->SetConfig(config); - SIMULATED_WAIT(false, 11000, clock); - // Expect regathering to happen for 5 times on all networks in the last 11s - // with 2s interval. - EXPECT_EQ(5, GetRegatheringReasonCount( - cricket::IceRegatheringReason::OCCASIONAL_REFRESH)); -} - -// Tests that ICE regathering on all networks can be canceled by changing the -// config. -TEST_F(RegatheringControllerTest, IceRegatheringOnAllNetworksCanBeCanceled) { - rtc::ScopedFakeClock clock; - InitializeAndGatherOnceWithSessionCleared(); - - rtc::IntervalRange regather_all_networks_interval_range(2000, 2000); - BasicRegatheringController::Config config( - regather_all_networks_interval_range, 2000); - regathering_controller()->SetConfig(config); - regathering_controller()->Start(); - config.regather_on_all_networks_interval_range.reset(); - // Set the regathering interval range on all networks to nullopt should cancel - // the schedule on all networks. - regathering_controller()->SetConfig(config); - SIMULATED_WAIT(false, 10000, clock); - // Expect no regathering on all networks happened in the last 10s. - EXPECT_EQ(0, GetRegatheringReasonCount( - cricket::IceRegatheringReason::OCCASIONAL_REFRESH)); -} - -// Tests that canceling the regathering on all networks does not cancel the -// schedule on failed networks. -TEST_F(RegatheringControllerTest, - CancelingRegatheringOnAllNetworksDoesNotCancelOnFailedNetworks) { - rtc::ScopedFakeClock clock; - InitializeAndGatherOnceWithSessionCleared(); - - rtc::IntervalRange regather_all_networks_interval_range(2000, 2000); - BasicRegatheringController::Config config( - regather_all_networks_interval_range, 2000); - regathering_controller()->SetConfig(config); - regathering_controller()->Start(); - config.regather_on_all_networks_interval_range = - rtc::IntervalRange(20000, 20000); - // Canceling and rescheduling the regathering on all networks should not - // impact the schedule for failed networks. - regathering_controller()->SetConfig(config); - SIMULATED_WAIT(false, 11000, clock); - // Expect regathering to happen for 5 times for failed networks in the last - // 11s with 2s interval. - EXPECT_EQ(5, GetRegatheringReasonCount( - cricket::IceRegatheringReason::NETWORK_FAILURE)); -} - -// Tests that canceling the regathering on failed networks does not cancel the -// schedule on all networks. -TEST_F(RegatheringControllerTest, - CancelingRegatheringOnFailedNetworksDoesNotCancelOnAllNetworks) { - rtc::ScopedFakeClock clock; - InitializeAndGatherOnceWithSessionCleared(); - - rtc::IntervalRange regather_all_networks_interval_range(2000, 2000); - BasicRegatheringController::Config config( - regather_all_networks_interval_range, 2000); - regathering_controller()->SetConfig(config); - regathering_controller()->Start(); - config.regather_on_failed_networks_interval = 20000; - // Canceling and rescheduling the regathering on failed networks should not - // impact the schedule for all networks. - regathering_controller()->SetConfig(config); - SIMULATED_WAIT(false, 11000, clock); - // Expect regathering to happen for 5 times for all networks in the last 11s - // with 2s interval. - EXPECT_EQ(5, GetRegatheringReasonCount( - cricket::IceRegatheringReason::OCCASIONAL_REFRESH)); -} - -// Tests that the schedule of ICE regathering on all networks can be canceled -// and replaced by a new recurring schedule. -TEST_F(RegatheringControllerTest, - ScheduleOfIceRegatheringOnAllNetworksCanBeReplaced) { - rtc::ScopedFakeClock clock; - InitializeAndGatherOnceWithSessionCleared(); - - rtc::IntervalRange regather_all_networks_interval_range(2000, 2000); - BasicRegatheringController::Config config( - regather_all_networks_interval_range, 2000); - regathering_controller()->SetConfig(config); - regathering_controller()->Start(); - config.regather_on_all_networks_interval_range = - rtc::IntervalRange(5000, 5000); - regathering_controller()->SetConfig(config); - SIMULATED_WAIT(false, 3000, clock); - // Expect no regathering from the previous schedule. - EXPECT_EQ(0, GetRegatheringReasonCount( - cricket::IceRegatheringReason::OCCASIONAL_REFRESH)); - SIMULATED_WAIT(false, 11000 - 3000, clock); - // Expect regathering to happen twice in the last 11s with 5s interval. - EXPECT_EQ(2, GetRegatheringReasonCount( - cricket::IceRegatheringReason::OCCASIONAL_REFRESH)); -} - // Tests that the schedule of ICE regathering on failed networks can be canceled // and replaced by a new recurring schedule. TEST_F(RegatheringControllerTest, @@ -288,9 +162,8 @@ TEST_F(RegatheringControllerTest, rtc::ScopedFakeClock clock; InitializeAndGatherOnceWithSessionCleared(); - rtc::IntervalRange regather_all_networks_interval_range(2000, 2000); - BasicRegatheringController::Config config( - regather_all_networks_interval_range, 2000); + BasicRegatheringController::Config config; + config.regather_on_failed_networks_interval = 2000; regathering_controller()->SetConfig(config); regathering_controller()->Start(); config.regather_on_failed_networks_interval = 5000; diff --git a/p2p/base/stun_request.cc b/p2p/base/stun_request.cc index 964b80f04e..b4dba7d3a0 100644 --- a/p2p/base/stun_request.cc +++ b/p2p/base/stun_request.cc @@ -17,6 +17,7 @@ #include "rtc_base/checks.h" #include "rtc_base/helpers.h" #include "rtc_base/logging.h" +#include "rtc_base/string_encode.h" #include "rtc_base/time_utils.h" // For TimeMillis #include "system_wrappers/include/field_trial.h" diff --git a/p2p/client/basic_port_allocator.cc b/p2p/client/basic_port_allocator.cc index bd25ab50ce..8aeef9361d 100644 --- a/p2p/client/basic_port_allocator.cc +++ b/p2p/client/basic_port_allocator.cc @@ -463,23 +463,6 @@ void BasicPortAllocatorSession::RegatherOnFailedNetworks() { IceRegatheringReason::NETWORK_FAILURE); } -void BasicPortAllocatorSession::RegatherOnAllNetworks() { - RTC_DCHECK_RUN_ON(network_thread_); - - std::vector networks = GetNetworks(); - if (networks.empty()) { - return; - } - - RTC_LOG(LS_INFO) << "Regather candidates on all networks"; - - // We expect to generate candidates that are equivalent to what we have now. - // Force DoAllocate to generate them instead of skipping. - bool disable_equivalent_phases = false; - Regather(networks, disable_equivalent_phases, - IceRegatheringReason::OCCASIONAL_REFRESH); -} - void BasicPortAllocatorSession::Regather( const std::vector& networks, bool disable_equivalent_phases, diff --git a/p2p/client/basic_port_allocator.h b/p2p/client/basic_port_allocator.h index 1272fab26a..b9f2b2ebd2 100644 --- a/p2p/client/basic_port_allocator.h +++ b/p2p/client/basic_port_allocator.h @@ -141,7 +141,6 @@ class RTC_EXPORT BasicPortAllocatorSession : public PortAllocatorSession, std::vector ReadyCandidates() const override; bool CandidatesAllocationDone() const override; void RegatherOnFailedNetworks() override; - void RegatherOnAllNetworks() override; void GetCandidateStatsFromReadyPorts( CandidateStatsList* candidate_stats_list) const override; void SetStunKeepaliveIntervalForReadyPorts( diff --git a/pc/peer_connection.cc b/pc/peer_connection.cc index a43b49a994..cf4189b896 100644 --- a/pc/peer_connection.cc +++ b/pc/peer_connection.cc @@ -892,7 +892,6 @@ bool PeerConnectionInterface::RTCConfiguration::operator==( absl::optional ice_unwritable_min_checks; absl::optional ice_inactive_timeout; absl::optional stun_candidate_keepalive_interval; - absl::optional ice_regather_interval_range; webrtc::TurnCustomizer* turn_customizer; SdpSemantics sdp_semantics; absl::optional network_preference; @@ -958,7 +957,6 @@ bool PeerConnectionInterface::RTCConfiguration::operator==( ice_inactive_timeout == o.ice_inactive_timeout && stun_candidate_keepalive_interval == o.stun_candidate_keepalive_interval && - ice_regather_interval_range == o.ice_regather_interval_range && turn_customizer == o.turn_customizer && sdp_semantics == o.sdp_semantics && network_preference == o.network_preference && @@ -1424,15 +1422,8 @@ bool PeerConnection::Initialize( RTCError PeerConnection::ValidateConfiguration( const RTCConfiguration& config) const { - if (config.ice_regather_interval_range && - config.continual_gathering_policy == GATHER_ONCE) { - return RTCError(RTCErrorType::INVALID_PARAMETER, - "ice_regather_interval_range specified but continual " - "gathering policy is GATHER_ONCE"); - } - auto result = - cricket::P2PTransportChannel::ValidateIceConfig(ParseIceConfig(config)); - return result; + return cricket::P2PTransportChannel::ValidateIceConfig( + ParseIceConfig(config)); } rtc::scoped_refptr PeerConnection::local_streams() { @@ -6165,8 +6156,6 @@ cricket::IceConfig PeerConnection::ParseIceConfig( ice_config.ice_unwritable_min_checks = config.ice_unwritable_min_checks; ice_config.ice_inactive_timeout = config.ice_inactive_timeout; ice_config.stun_keepalive_interval = config.stun_candidate_keepalive_interval; - ice_config.regather_all_networks_interval_range = - config.ice_regather_interval_range; ice_config.network_preference = config.network_preference; return ice_config; } diff --git a/pc/peer_connection_interface_unittest.cc b/pc/peer_connection_interface_unittest.cc index 7f42b8cb95..8db8751b64 100644 --- a/pc/peer_connection_interface_unittest.cc +++ b/pc/peer_connection_interface_unittest.cc @@ -3666,28 +3666,6 @@ TEST_P(PeerConnectionInterfaceTest, SetBitrateMaxNegativeFails) { EXPECT_FALSE(pc_->SetBitrate(bitrate).ok()); } -// ice_regather_interval_range requires WebRTC to be configured for continual -// gathering already. -TEST_P(PeerConnectionInterfaceTest, - SetIceRegatherIntervalRangeWithoutContinualGatheringFails) { - PeerConnectionInterface::RTCConfiguration config; - config.ice_regather_interval_range.emplace(1000, 2000); - config.continual_gathering_policy = - PeerConnectionInterface::ContinualGatheringPolicy::GATHER_ONCE; - CreatePeerConnectionExpectFail(config); -} - -// Ensures that there is no error when ice_regather_interval_range is set with -// continual gathering enabled. -TEST_P(PeerConnectionInterfaceTest, - SetIceRegatherIntervalRangeWithContinualGathering) { - PeerConnectionInterface::RTCConfiguration config; - config.ice_regather_interval_range.emplace(1000, 2000); - config.continual_gathering_policy = - PeerConnectionInterface::ContinualGatheringPolicy::GATHER_CONTINUALLY; - CreatePeerConnection(config); -} - // The current bitrate from BitrateSettings is currently clamped // by Call's BitrateConstraints, which comes from the SDP or a default value. // This test checks that a call to SetBitrate with a current bitrate that will diff --git a/rtc_base/async_packet_socket.h b/rtc_base/async_packet_socket.h index 50c07e2056..d47d57b692 100644 --- a/rtc_base/async_packet_socket.h +++ b/rtc_base/async_packet_socket.h @@ -11,6 +11,8 @@ #ifndef RTC_BASE_ASYNC_PACKET_SOCKET_H_ #define RTC_BASE_ASYNC_PACKET_SOCKET_H_ +#include + #include "rtc_base/constructor_magic.h" #include "rtc_base/dscp.h" #include "rtc_base/network/sent_packet.h" diff --git a/rtc_base/time_utils.h b/rtc_base/time_utils.h index ef54c35893..147ab8daf8 100644 --- a/rtc_base/time_utils.h +++ b/rtc_base/time_utils.h @@ -14,10 +14,7 @@ #include #include -#include - #include "rtc_base/checks.h" -#include "rtc_base/strings/string_builder.h" #include "rtc_base/system/rtc_export.h" namespace rtc { @@ -137,34 +134,6 @@ int64_t TimeUTCMicros(); // See above. int64_t TimeUTCMillis(); -// Interval of time from the range [min, max] inclusive. -class IntervalRange { - public: - IntervalRange() : min_(0), max_(0) {} - IntervalRange(int min, int max) : min_(min), max_(max) { - RTC_DCHECK_LE(min, max); - } - - int min() const { return min_; } - int max() const { return max_; } - - std::string ToString() const { - rtc::StringBuilder ss; - ss << "[" << min_ << "," << max_ << "]"; - return ss.Release(); - } - - bool operator==(const IntervalRange& o) const { - return min_ == o.min_ && max_ == o.max_; - } - - bool operator!=(const IntervalRange& o) const { return !operator==(o); } - - private: - int min_; - int max_; -}; - } // namespace rtc #endif // RTC_BASE_TIME_UTILS_H_ diff --git a/rtc_base/virtual_socket_server.h b/rtc_base/virtual_socket_server.h index 9d3aa9e633..f45fabf0af 100644 --- a/rtc_base/virtual_socket_server.h +++ b/rtc_base/virtual_socket_server.h @@ -13,6 +13,7 @@ #include #include +#include #include "rtc_base/checks.h" #include "rtc_base/constructor_magic.h" diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn index 24d6527835..13793fb06b 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -840,9 +840,6 @@ if (is_ios || is_mac) { "objc/api/peerconnection/RTCIceServer+Private.h", "objc/api/peerconnection/RTCIceServer.h", "objc/api/peerconnection/RTCIceServer.mm", - "objc/api/peerconnection/RTCIntervalRange+Private.h", - "objc/api/peerconnection/RTCIntervalRange.h", - "objc/api/peerconnection/RTCIntervalRange.mm", "objc/api/peerconnection/RTCLegacyStatsReport+Private.h", "objc/api/peerconnection/RTCLegacyStatsReport.h", "objc/api/peerconnection/RTCLegacyStatsReport.mm", @@ -1005,7 +1002,6 @@ if (is_ios || is_mac) { "objc/Framework/Headers/WebRTC/RTCH264ProfileLevelId.h", "objc/Framework/Headers/WebRTC/RTCIceCandidate.h", "objc/Framework/Headers/WebRTC/RTCIceServer.h", - "objc/Framework/Headers/WebRTC/RTCIntervalRange.h", "objc/Framework/Headers/WebRTC/RTCLegacyStatsReport.h", "objc/Framework/Headers/WebRTC/RTCLogging.h", "objc/Framework/Headers/WebRTC/RTCMTLNSVideoView.h", @@ -1183,7 +1179,6 @@ if (is_ios || is_mac) { "objc/unittests/RTCDataChannelConfigurationTest.mm", "objc/unittests/RTCIceCandidateTest.mm", "objc/unittests/RTCIceServerTest.mm", - "objc/unittests/RTCIntervalRangeTests.mm", "objc/unittests/RTCMediaConstraintsTest.mm", "objc/unittests/RTCPeerConnectionFactoryBuilderTest.mm", "objc/unittests/RTCPeerConnectionTest.mm", @@ -1293,7 +1288,6 @@ if (is_ios || is_mac) { "objc/api/peerconnection/RTCFieldTrials.h", "objc/api/peerconnection/RTCIceCandidate.h", "objc/api/peerconnection/RTCIceServer.h", - "objc/api/peerconnection/RTCIntervalRange.h", "objc/api/peerconnection/RTCLegacyStatsReport.h", "objc/api/peerconnection/RTCMediaConstraints.h", "objc/api/peerconnection/RTCMediaSource.h", @@ -1408,7 +1402,6 @@ if (is_ios || is_mac) { "objc/api/peerconnection/RTCFieldTrials.h", "objc/api/peerconnection/RTCIceCandidate.h", "objc/api/peerconnection/RTCIceServer.h", - "objc/api/peerconnection/RTCIntervalRange.h", "objc/api/peerconnection/RTCLegacyStatsReport.h", "objc/api/peerconnection/RTCMediaConstraints.h", "objc/api/peerconnection/RTCMediaSource.h", diff --git a/sdk/android/api/org/webrtc/PeerConnection.java b/sdk/android/api/org/webrtc/PeerConnection.java index bf5a73482b..7891b7f6b4 100644 --- a/sdk/android/api/org/webrtc/PeerConnection.java +++ b/sdk/android/api/org/webrtc/PeerConnection.java @@ -415,27 +415,6 @@ public class PeerConnection { KEEP_FIRST_READY // Keep the first ready port and prune the rest on the same network. } - /** Java version of rtc::IntervalRange */ - public static class IntervalRange { - private final int min; - private final int max; - - public IntervalRange(int min, int max) { - this.min = min; - this.max = max; - } - - @CalledByNative("IntervalRange") - public int getMin() { - return min; - } - - @CalledByNative("IntervalRange") - public int getMax() { - return max; - } - } - /** * Java version of webrtc::SdpSemantics. * @@ -525,7 +504,6 @@ public class PeerConnection { // // Can be set to Integer.MAX_VALUE to effectively disable the limit. public int maxIPv6Networks; - @Nullable public IntervalRange iceRegatherIntervalRange; // These values will be overridden by MediaStream constraints if deprecated constraints-based // create peerconnection interface is used. @@ -609,7 +587,6 @@ public class PeerConnection { stunCandidateKeepaliveIntervalMs = null; disableIPv6OnWifi = false; maxIPv6Networks = 5; - iceRegatherIntervalRange = null; disableIpv6 = false; enableDscp = false; enableCpuOveruseDetection = true; @@ -765,12 +742,6 @@ public class PeerConnection { return maxIPv6Networks; } - @Nullable - @CalledByNative("RTCConfiguration") - IntervalRange getIceRegatherIntervalRange() { - return iceRegatherIntervalRange; - } - @Nullable @CalledByNative("RTCConfiguration") TurnCustomizer getTurnCustomizer() { diff --git a/sdk/android/instrumentationtests/src/org/webrtc/PeerConnectionTest.java b/sdk/android/instrumentationtests/src/org/webrtc/PeerConnectionTest.java index d339f6a3e6..f1141e11d9 100644 --- a/sdk/android/instrumentationtests/src/org/webrtc/PeerConnectionTest.java +++ b/sdk/android/instrumentationtests/src/org/webrtc/PeerConnectionTest.java @@ -168,7 +168,6 @@ public class PeerConnectionTest { // Test configuration options. config.continualGatheringPolicy = PeerConnection.ContinualGatheringPolicy.GATHER_CONTINUALLY; - config.iceRegatherIntervalRange = new PeerConnection.IntervalRange(1000, 2000); PeerConnection offeringPC = factory.createPeerConnection(config, mock(PeerConnection.Observer.class)); diff --git a/sdk/android/src/jni/pc/peer_connection.cc b/sdk/android/src/jni/pc/peer_connection.cc index 9b1cce6155..0ae39fbf66 100644 --- a/sdk/android/src/jni/pc/peer_connection.cc +++ b/sdk/android/src/jni/pc/peer_connection.cc @@ -240,13 +240,6 @@ void JavaToNativeRTCConfiguration( Java_RTCConfiguration_getDisableIPv6OnWifi(jni, j_rtc_config); rtc_config->max_ipv6_networks = Java_RTCConfiguration_getMaxIPv6Networks(jni, j_rtc_config); - ScopedJavaLocalRef j_ice_regather_interval_range = - Java_RTCConfiguration_getIceRegatherIntervalRange(jni, j_rtc_config); - if (!IsNull(jni, j_ice_regather_interval_range)) { - int min = Java_IntervalRange_getMin(jni, j_ice_regather_interval_range); - int max = Java_IntervalRange_getMax(jni, j_ice_regather_interval_range); - rtc_config->ice_regather_interval_range.emplace(min, max); - } rtc_config->turn_customizer = GetNativeTurnCustomizer(jni, j_turn_customizer); diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCIntervalRange.h b/sdk/objc/Framework/Headers/WebRTC/RTCIntervalRange.h deleted file mode 100644 index 65726ee762..0000000000 --- a/sdk/objc/Framework/Headers/WebRTC/RTCIntervalRange.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright 2017 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#import "api/peerconnection/RTCIntervalRange.h" diff --git a/sdk/objc/api/peerconnection/RTCConfiguration.h b/sdk/objc/api/peerconnection/RTCConfiguration.h index 13a51b961f..7400296451 100644 --- a/sdk/objc/api/peerconnection/RTCConfiguration.h +++ b/sdk/objc/api/peerconnection/RTCConfiguration.h @@ -15,7 +15,6 @@ #import "RTCMacros.h" @class RTCIceServer; -@class RTCIntervalRange; /** * Represents the ice transport policy. This exposes the same states in C++, @@ -157,13 +156,6 @@ RTC_OBJC_EXPORT */ @property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval; -/** ICE Periodic Regathering - * If set, WebRTC will periodically create and propose candidates without - * starting a new ICE generation. The regathering happens continuously with - * interval specified in milliseconds by the uniform distribution [a, b]. - */ -@property(nonatomic, strong, nullable) RTCIntervalRange *iceRegatherIntervalRange; - /** Configure the SDP semantics used by this PeerConnection. Note that the * WebRTC 1.0 specification requires UnifiedPlan semantics. The * RTCRtpTransceiver API is only available with UnifiedPlan semantics. diff --git a/sdk/objc/api/peerconnection/RTCConfiguration.mm b/sdk/objc/api/peerconnection/RTCConfiguration.mm index 7503a0a01f..7f9f591b74 100644 --- a/sdk/objc/api/peerconnection/RTCConfiguration.mm +++ b/sdk/objc/api/peerconnection/RTCConfiguration.mm @@ -15,7 +15,6 @@ #import "RTCCertificate.h" #import "RTCConfiguration+Native.h" #import "RTCIceServer+Private.h" -#import "RTCIntervalRange+Private.h" #import "base/RTCLogging.h" #include "rtc_base/rtc_certificate_generator.h" @@ -48,7 +47,6 @@ @synthesize shouldSurfaceIceCandidatesOnIceTransportTypeChanged = _shouldSurfaceIceCandidatesOnIceTransportTypeChanged; @synthesize iceCheckMinInterval = _iceCheckMinInterval; -@synthesize iceRegatherIntervalRange = _iceRegatherIntervalRange; @synthesize sdpSemantics = _sdpSemantics; @synthesize turnCustomizer = _turnCustomizer; @synthesize activeResetSrtpParams = _activeResetSrtpParams; @@ -118,11 +116,6 @@ _iceCheckMinInterval = [NSNumber numberWithInt:*config.ice_check_min_interval]; } - if (config.ice_regather_interval_range) { - const rtc::IntervalRange &nativeIntervalRange = config.ice_regather_interval_range.value(); - _iceRegatherIntervalRange = - [[RTCIntervalRange alloc] initWithNativeIntervalRange:nativeIntervalRange]; - } _sdpSemantics = [[self class] sdpSemanticsForNativeSdpSemantics:config.sdp_semantics]; _turnCustomizer = config.turn_customizer; _activeResetSrtpParams = config.active_reset_srtp_params; @@ -147,7 +140,7 @@ - (NSString *)description { static NSString *formatString = @"RTCConfiguration: " @"{\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%d\n%d\n%d\n%d\n%d\n%d\n" - @"%d\n%@\n%@\n%d\n%d\n%d\n%d\n%d\n%@\n}\n"; + @"%d\n%@\n%d\n%d\n%d\n%d\n%d\n%@\n}\n"; return [NSString stringWithFormat:formatString, @@ -168,7 +161,6 @@ _shouldPresumeWritableWhenFullyRelayed, _shouldSurfaceIceCandidatesOnIceTransportTypeChanged, _iceCheckMinInterval, - _iceRegatherIntervalRange, _disableLinkLocalNetworks, _disableIPV6, _disableIPV6OnWiFi, @@ -251,12 +243,6 @@ if (_iceCheckMinInterval != nil) { nativeConfig->ice_check_min_interval = absl::optional(_iceCheckMinInterval.intValue); } - if (_iceRegatherIntervalRange != nil) { - std::unique_ptr nativeIntervalRange( - _iceRegatherIntervalRange.nativeIntervalRange); - nativeConfig->ice_regather_interval_range = - absl::optional(*nativeIntervalRange); - } nativeConfig->sdp_semantics = [[self class] nativeSdpSemanticsForSdpSemantics:_sdpSemantics]; if (_turnCustomizer) { nativeConfig->turn_customizer = _turnCustomizer; diff --git a/sdk/objc/api/peerconnection/RTCIntervalRange+Private.h b/sdk/objc/api/peerconnection/RTCIntervalRange+Private.h deleted file mode 100644 index afa7509a35..0000000000 --- a/sdk/objc/api/peerconnection/RTCIntervalRange+Private.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#import "RTCIntervalRange.h" - -#include "rtc_base/time_utils.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface RTCIntervalRange () - -@property(nonatomic, readonly) std::unique_ptr nativeIntervalRange; - -- (instancetype)initWithNativeIntervalRange:(const rtc::IntervalRange &)config; - -@end - -NS_ASSUME_NONNULL_END diff --git a/sdk/objc/api/peerconnection/RTCIntervalRange.h b/sdk/objc/api/peerconnection/RTCIntervalRange.h deleted file mode 100644 index 00508eba17..0000000000 --- a/sdk/objc/api/peerconnection/RTCIntervalRange.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface RTCIntervalRange : NSObject - -@property(nonatomic, readonly) NSInteger min; -@property(nonatomic, readonly) NSInteger max; - -- (instancetype)init; -- (instancetype)initWithMin:(NSInteger)min max:(NSInteger)max NS_DESIGNATED_INITIALIZER; - -@end - -NS_ASSUME_NONNULL_END diff --git a/sdk/objc/api/peerconnection/RTCIntervalRange.mm b/sdk/objc/api/peerconnection/RTCIntervalRange.mm deleted file mode 100644 index 0a861ea0d1..0000000000 --- a/sdk/objc/api/peerconnection/RTCIntervalRange.mm +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2017 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#import "RTCIntervalRange+Private.h" - -#include "rtc_base/checks.h" - -@implementation RTCIntervalRange - -@synthesize min = _min; -@synthesize max = _max; - -- (instancetype)init { - return [self initWithMin:0 max:0]; -} - -- (instancetype)initWithMin:(NSInteger)min - max:(NSInteger)max { - RTC_DCHECK_LE(min, max); - if (self = [super init]) { - _min = min; - _max = max; - } - return self; -} - -- (instancetype)initWithNativeIntervalRange:(const rtc::IntervalRange &)config { - return [self initWithMin:config.min() max:config.max()]; -} - -- (NSString *)description { - return [NSString stringWithFormat:@"[%ld, %ld]", (long)_min, (long)_max]; -} - -#pragma mark - Private - -- (std::unique_ptr)nativeIntervalRange { - std::unique_ptr nativeIntervalRange( - new rtc::IntervalRange((int)_min, (int)_max)); - return nativeIntervalRange; -} - -@end diff --git a/sdk/objc/unittests/RTCConfigurationTest.mm b/sdk/objc/unittests/RTCConfigurationTest.mm index f31fcfd858..3fb4d428e4 100644 --- a/sdk/objc/unittests/RTCConfigurationTest.mm +++ b/sdk/objc/unittests/RTCConfigurationTest.mm @@ -17,7 +17,6 @@ #import "api/peerconnection/RTCConfiguration+Private.h" #import "api/peerconnection/RTCConfiguration.h" #import "api/peerconnection/RTCIceServer.h" -#import "api/peerconnection/RTCIntervalRange.h" #import "helpers/NSString+StdString.h" @interface RTCConfigurationTest : NSObject @@ -30,7 +29,6 @@ - (void)testConversionToNativeConfiguration { NSArray *urlStrings = @[ @"stun:stun1.example.net" ]; RTCIceServer *server = [[RTCIceServer alloc] initWithURLStrings:urlStrings]; - RTCIntervalRange *range = [[RTCIntervalRange alloc] initWithMin:0 max:100]; RTCConfiguration *config = [[RTCConfiguration alloc] init]; config.iceServers = @[ server ]; @@ -49,7 +47,6 @@ config.continualGatheringPolicy = RTCContinualGatheringPolicyGatherContinually; config.shouldPruneTurnPorts = YES; - config.iceRegatherIntervalRange = range; config.cryptoOptions = [[RTCCryptoOptions alloc] initWithSrtpEnableGcmCryptoSuites:YES srtpEnableAes128Sha1_32CryptoCipher:YES srtpEnableEncryptedRtpHeaderExtensions:YES @@ -82,8 +79,6 @@ EXPECT_EQ(webrtc::PeerConnectionInterface::GATHER_CONTINUALLY, nativeConfig->continual_gathering_policy); EXPECT_EQ(true, nativeConfig->prune_turn_ports); - EXPECT_EQ(range.min, nativeConfig->ice_regather_interval_range->min()); - EXPECT_EQ(range.max, nativeConfig->ice_regather_interval_range->max()); EXPECT_EQ(true, nativeConfig->crypto_options->srtp.enable_gcm_crypto_suites); EXPECT_EQ(true, nativeConfig->crypto_options->srtp.enable_aes128_sha1_32_crypto_cipher); EXPECT_EQ(true, nativeConfig->crypto_options->srtp.enable_encrypted_rtp_header_extensions); @@ -95,7 +90,6 @@ - (void)testNativeConversionToConfiguration { NSArray *urlStrings = @[ @"stun:stun1.example.net" ]; RTCIceServer *server = [[RTCIceServer alloc] initWithURLStrings:urlStrings]; - RTCIntervalRange *range = [[RTCIntervalRange alloc] initWithMin:0 max:100]; RTCConfiguration *config = [[RTCConfiguration alloc] init]; config.iceServers = @[ server ]; @@ -114,7 +108,6 @@ config.continualGatheringPolicy = RTCContinualGatheringPolicyGatherContinually; config.shouldPruneTurnPorts = YES; - config.iceRegatherIntervalRange = range; config.cryptoOptions = [[RTCCryptoOptions alloc] initWithSrtpEnableGcmCryptoSuites:YES srtpEnableAes128Sha1_32CryptoCipher:NO srtpEnableEncryptedRtpHeaderExtensions:NO @@ -146,8 +139,6 @@ newConfig.iceBackupCandidatePairPingInterval); EXPECT_EQ(config.continualGatheringPolicy, newConfig.continualGatheringPolicy); EXPECT_EQ(config.shouldPruneTurnPorts, newConfig.shouldPruneTurnPorts); - EXPECT_EQ(config.iceRegatherIntervalRange.min, newConfig.iceRegatherIntervalRange.min); - EXPECT_EQ(config.iceRegatherIntervalRange.max, newConfig.iceRegatherIntervalRange.max); EXPECT_EQ(config.cryptoOptions.srtpEnableGcmCryptoSuites, newConfig.cryptoOptions.srtpEnableGcmCryptoSuites); EXPECT_EQ(config.cryptoOptions.srtpEnableAes128Sha1_32CryptoCipher, diff --git a/sdk/objc/unittests/RTCIntervalRangeTests.mm b/sdk/objc/unittests/RTCIntervalRangeTests.mm deleted file mode 100644 index 9244c5ba29..0000000000 --- a/sdk/objc/unittests/RTCIntervalRangeTests.mm +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2017 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#import - -#include "rtc_base/gunit.h" - -#import "api/peerconnection/RTCIntervalRange+Private.h" -#import "api/peerconnection/RTCIntervalRange.h" - -@interface RTCIntervalRangeTest : NSObject -- (void)testConversionToNativeConfiguration; -- (void)testNativeConversionToConfiguration; -@end - -@implementation RTCIntervalRangeTest - -- (void)testConversionToNativeConfiguration { - NSInteger min = 0; - NSInteger max = 100; - RTCIntervalRange *range = [[RTCIntervalRange alloc] initWithMin:min max:max]; - EXPECT_EQ(min, range.min); - EXPECT_EQ(max, range.max); - std::unique_ptr nativeRange = range.nativeIntervalRange; - EXPECT_EQ(min, nativeRange->min()); - EXPECT_EQ(max, nativeRange->max()); -} - -- (void)testNativeConversionToConfiguration { - NSInteger min = 0; - NSInteger max = 100; - rtc::IntervalRange nativeRange((int)min, (int)max); - RTCIntervalRange *range = - [[RTCIntervalRange alloc] initWithNativeIntervalRange:nativeRange]; - EXPECT_EQ(min, range.min); - EXPECT_EQ(max, range.max); -} - -@end - -TEST(RTCIntervalRangeTest, NativeConfigurationConversionTest) { - @autoreleasepool { - RTCIntervalRangeTest *test = [[RTCIntervalRangeTest alloc] init]; - [test testConversionToNativeConfiguration]; - [test testNativeConversionToConfiguration]; - } -}