Remove iceRegatherIntervalRange

This was an ICE configuration experiment added a couple years ago that did not end up being used.

Bug: webrtc:11316
Change-Id: Iafb7e1c4f7b4598815f045808dbf6e470172f119
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/167680
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30395}
This commit is contained in:
Steve Anton 2020-01-27 15:45:02 -08:00 committed by Commit Bot
parent ed9a401f27
commit f417238217
31 changed files with 34 additions and 715 deletions

View file

@ -570,12 +570,6 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// binding requests to keep NAT bindings open. // binding requests to keep NAT bindings open.
absl::optional<int> stun_candidate_keepalive_interval; absl::optional<int> 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<rtc::IntervalRange> ice_regather_interval_range;
// Optional TurnCustomizer. // Optional TurnCustomizer.
// With this class one can modify outgoing TURN messages. // With this class one can modify outgoing TURN messages.
// The object passed in must remain valid until PeerConnection::Close() is // The object passed in must remain valid until PeerConnection::Close() is

View file

@ -30,6 +30,7 @@
#include "rtc_base/numerics/safe_minmax.h" #include "rtc_base/numerics/safe_minmax.h"
#include "rtc_base/string_encode.h" #include "rtc_base/string_encode.h"
#include "rtc_base/string_utils.h" #include "rtc_base/string_utils.h"
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/third_party/base64/base64.h" #include "rtc_base/third_party/base64/base64.h"
#include "system_wrappers/include/field_trial.h" #include "system_wrappers/include/field_trial.h"

View file

@ -132,10 +132,6 @@ class FakePortAllocatorSession : public PortAllocatorSession {
void ClearGettingPorts() override { is_cleared = true; } void ClearGettingPorts() override { is_cleared = true; }
bool IsCleared() const override { return is_cleared; } bool IsCleared() const override { return is_cleared; }
void RegatherOnAllNetworks() override {
SignalIceRegathering(this, IceRegatheringReason::OCCASIONAL_REFRESH);
}
void RegatherOnFailedNetworks() override { void RegatherOnFailedNetworks() override {
SignalIceRegathering(this, IceRegatheringReason::NETWORK_FAILURE); SignalIceRegathering(this, IceRegatheringReason::NETWORK_FAILURE);
} }

View file

@ -112,10 +112,6 @@ struct IceConfig {
// active network having no connection on it. // active network having no connection on it.
absl::optional<int> regather_on_failed_networks_interval; absl::optional<int> 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<rtc::IntervalRange> regather_all_networks_interval_range;
// The time period in which we will not switch the selected connection // The time period in which we will not switch the selected connection
// when a new connection becomes receiving but the selected connection is not // when a new connection becomes receiving but the selected connection is not
// in case that the selected connection may become receiving soon. // in case that the selected connection may become receiving soon.

View file

@ -116,9 +116,9 @@ P2PTransportChannel::P2PTransportChannel(
// Validate IceConfig even for mostly built-in constant default values in case // Validate IceConfig even for mostly built-in constant default values in case
// we change them. // we change them.
RTC_DCHECK(ValidateIceConfig(config_).ok()); RTC_DCHECK(ValidateIceConfig(config_).ok());
webrtc::BasicRegatheringController::Config regathering_config( webrtc::BasicRegatheringController::Config regathering_config;
config_.regather_all_networks_interval_range, regathering_config.regather_on_failed_networks_interval =
config_.regather_on_failed_networks_interval_or_default()); config_.regather_on_failed_networks_interval_or_default();
regathering_controller_ = regathering_controller_ =
std::make_unique<webrtc::BasicRegatheringController>( std::make_unique<webrtc::BasicRegatheringController>(
regathering_config, this, network_thread_); regathering_config, this, network_thread_);
@ -538,18 +538,6 @@ void P2PTransportChannel::SetIceConfig(const IceConfig& config) {
<< config_.regather_on_failed_networks_interval_or_default(); << 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) { if (config_.receiving_switching_delay != config.receiving_switching_delay) {
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 " 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; << *field_trials_.initial_select_dampening_ping_received;
} }
webrtc::BasicRegatheringController::Config regathering_config( webrtc::BasicRegatheringController::Config regathering_config;
config_.regather_all_networks_interval_range, regathering_config.regather_on_failed_networks_interval =
config_.regather_on_failed_networks_interval_or_default()); config_.regather_on_failed_networks_interval_or_default();
regathering_controller_->SetConfig(regathering_config); regathering_controller_->SetConfig(regathering_config);
ice_controller_->SetIceConfig(config_); ice_controller_->SetIceConfig(config_);
@ -697,13 +685,6 @@ const IceConfig& P2PTransportChannel::config() const {
// PeerConnection::SetConfiguration. // PeerConnection::SetConfiguration.
// Static // Static
RTCError P2PTransportChannel::ValidateIceConfig(const IceConfig& config) { 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() < if (config.ice_check_interval_strong_connectivity_or_default() <
config.ice_check_interval_weak_connectivity.value_or( config.ice_check_interval_weak_connectivity.value_or(
GetWeakPingIntervalInFieldTrial())) { GetWeakPingIntervalInFieldTrial())) {
@ -744,13 +725,6 @@ RTCError P2PTransportChannel::ValidateIceConfig(const IceConfig& config) {
"UNRELIABLE is longer than that to become TIMEOUT."); "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(); return RTCError::OK();
} }

View file

@ -1464,101 +1464,6 @@ TEST_F(P2PTransportChannelTest,
DestroyChannels(); 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<int>(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 // Test that we properly create a connection on a STUN ping from unknown address
// when the signaling is slow. // when the signaling is slow.
TEST_F(P2PTransportChannelTest, PeerReflexiveCandidateBeforeSignaling) { TEST_F(P2PTransportChannelTest, PeerReflexiveCandidateBeforeSignaling) {

View file

@ -31,6 +31,7 @@
#include "rtc_base/numerics/safe_minmax.h" #include "rtc_base/numerics/safe_minmax.h"
#include "rtc_base/string_encode.h" #include "rtc_base/string_encode.h"
#include "rtc_base/string_utils.h" #include "rtc_base/string_utils.h"
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/third_party/base64/base64.h" #include "rtc_base/third_party/base64/base64.h"
#include "system_wrappers/include/field_trial.h" #include "system_wrappers/include/field_trial.h"

View file

@ -240,8 +240,6 @@ class RTC_EXPORT PortAllocatorSession : public sigslot::has_slots<> {
// network. Only if all networks of an interface have no connection, the // network. Only if all networks of an interface have no connection, the
// implementation should start re-gathering on all networks of that interface. // implementation should start re-gathering on all networks of that interface.
virtual void RegatherOnFailedNetworks() {} 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 // Get candidate-level stats from all candidates on the ready ports and return
// the stats to the given list. // the stats to the given list.
virtual void GetCandidateStatsFromReadyPorts( virtual void GetCandidateStatsFromReadyPorts(

View file

@ -12,29 +12,11 @@
namespace webrtc { namespace webrtc {
using Config = BasicRegatheringController::Config;
Config::Config(const absl::optional<rtc::IntervalRange>&
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( BasicRegatheringController::BasicRegatheringController(
const Config& config, const Config& config,
cricket::IceTransportInternal* ice_transport, cricket::IceTransportInternal* ice_transport,
rtc::Thread* thread) rtc::Thread* thread)
: config_(config), : config_(config), ice_transport_(ice_transport), thread_(thread) {
ice_transport_(ice_transport),
thread_(thread),
rand_(rtc::SystemTimeNanos()) {
RTC_DCHECK(ice_transport_); RTC_DCHECK(ice_transport_);
RTC_DCHECK(thread_); RTC_DCHECK(thread_);
ice_transport_->SignalStateChanged.connect( ice_transport_->SignalStateChanged.connect(
@ -51,96 +33,41 @@ BasicRegatheringController::~BasicRegatheringController() = default;
void BasicRegatheringController::Start() { void BasicRegatheringController::Start() {
ScheduleRecurringRegatheringOnFailedNetworks(); ScheduleRecurringRegatheringOnFailedNetworks();
if (config_.regather_on_all_networks_interval_range) {
ScheduleRecurringRegatheringOnAllNetworks();
}
} }
void BasicRegatheringController::SetConfig(const Config& config) { 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 = bool need_cancel_and_reschedule_on_failed_networks =
has_recurring_schedule_on_failed_networks_ && has_recurring_schedule_on_failed_networks_ &&
(config_.regather_on_failed_networks_interval != (config_.regather_on_failed_networks_interval !=
config.regather_on_failed_networks_interval); config.regather_on_failed_networks_interval);
config_ = config; config_ = config;
if (need_cancel_on_all_networks) {
CancelScheduledRecurringRegatheringOnAllNetworks();
}
if (need_reschedule_on_all_networks) {
ScheduleRecurringRegatheringOnAllNetworks();
}
if (need_cancel_and_reschedule_on_failed_networks) { if (need_cancel_and_reschedule_on_failed_networks) {
CancelScheduledRecurringRegatheringOnFailedNetworks(); CancelScheduledRecurringRegatheringOnFailedNetworks();
ScheduleRecurringRegatheringOnFailedNetworks(); 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<void>(
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:: void BasicRegatheringController::
ScheduleRecurringRegatheringOnFailedNetworks() { ScheduleRecurringRegatheringOnFailedNetworks() {
RTC_DCHECK(config_.regather_on_failed_networks_interval >= 0); RTC_DCHECK(config_.regather_on_failed_networks_interval >= 0);
CancelScheduledRecurringRegatheringOnFailedNetworks(); CancelScheduledRecurringRegatheringOnFailedNetworks();
has_recurring_schedule_on_failed_networks_ = true; has_recurring_schedule_on_failed_networks_ = true;
invoker_for_failed_networks_.AsyncInvokeDelayed<void>( invoker_for_failed_networks_.AsyncInvokeDelayed<void>(
RTC_FROM_HERE, thread(), RTC_FROM_HERE, thread_,
rtc::Bind( rtc::Bind(
&BasicRegatheringController::RegatherOnFailedNetworksIfDoneGathering, &BasicRegatheringController::RegatherOnFailedNetworksIfDoneGathering,
this, true), this),
config_.regather_on_failed_networks_interval); config_.regather_on_failed_networks_interval);
} }
void BasicRegatheringController::RegatherOnFailedNetworksIfDoneGathering( void BasicRegatheringController::RegatherOnFailedNetworksIfDoneGathering() {
bool repeated) {
// Only regather when the current session is in the CLEARED state (i.e., not // 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 // 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. // continually, so there is an implicit check on continual gathering here.
if (allocator_session_ && allocator_session_->IsCleared()) { if (allocator_session_ && allocator_session_->IsCleared()) {
allocator_session_->RegatherOnFailedNetworks(); allocator_session_->RegatherOnFailedNetworks();
} }
if (repeated) { ScheduleRecurringRegatheringOnFailedNetworks();
ScheduleRecurringRegatheringOnFailedNetworks();
}
}
void BasicRegatheringController::
CancelScheduledRecurringRegatheringOnAllNetworks() {
invoker_for_all_networks_.Clear();
has_recurring_schedule_on_all_networks_ = false;
} }
void BasicRegatheringController:: void BasicRegatheringController::
@ -149,9 +76,4 @@ void BasicRegatheringController::
has_recurring_schedule_on_failed_networks_ = false; has_recurring_schedule_on_failed_networks_ = false;
} }
int BasicRegatheringController::SampleRegatherAllNetworksInterval(
const rtc::IntervalRange& range) {
return rand_.Rand(range.min(), range.max());
}
} // namespace webrtc } // namespace webrtc

View file

@ -14,7 +14,6 @@
#include "p2p/base/ice_transport_internal.h" #include "p2p/base/ice_transport_internal.h"
#include "p2p/base/port_allocator.h" #include "p2p/base/port_allocator.h"
#include "rtc_base/async_invoker.h" #include "rtc_base/async_invoker.h"
#include "rtc_base/random.h"
#include "rtc_base/thread.h" #include "rtc_base/thread.h"
namespace webrtc { namespace webrtc {
@ -22,12 +21,9 @@ namespace webrtc {
// Controls regathering of candidates for the ICE transport passed into it, // Controls regathering of candidates for the ICE transport passed into it,
// reacting to signals like SignalWritableState, SignalNetworkRouteChange, etc., // reacting to signals like SignalWritableState, SignalNetworkRouteChange, etc.,
// using methods like GetStats to get additional information, and calling // 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. // 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 // "Regathering" is defined as gathering additional candidates within a single
// ICE generation (or in other words, PortAllocatorSession), and is possible // ICE generation (or in other words, PortAllocatorSession), and is possible
// when "continual gathering" is enabled. This may allow connectivity to be // when "continual gathering" is enabled. This may allow connectivity to be
@ -46,14 +42,8 @@ namespace webrtc {
class BasicRegatheringController : public sigslot::has_slots<> { class BasicRegatheringController : public sigslot::has_slots<> {
public: public:
struct Config { struct Config {
Config(const absl::optional<rtc::IntervalRange>& int regather_on_failed_networks_interval =
regather_on_all_networks_interval_range, cricket::REGATHER_ON_FAILED_NETWORKS_INTERVAL;
int regather_on_failed_networks_interval);
Config(const Config& other);
~Config();
Config& operator=(const Config& other);
absl::optional<rtc::IntervalRange> regather_on_all_networks_interval_range;
int regather_on_failed_networks_interval;
}; };
BasicRegatheringController() = delete; BasicRegatheringController() = delete;
@ -83,11 +73,6 @@ class BasicRegatheringController : public sigslot::has_slots<> {
void OnIceTransportWritableState(rtc::PacketTransportInternal*) {} void OnIceTransportWritableState(rtc::PacketTransportInternal*) {}
void OnIceTransportReceivingState(rtc::PacketTransportInternal*) {} void OnIceTransportReceivingState(rtc::PacketTransportInternal*) {}
void OnIceTransportNetworkRouteChanged(absl::optional<rtc::NetworkRoute>) {} void OnIceTransportNetworkRouteChanged(absl::optional<rtc::NetworkRoute>) {}
// 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 // Schedules delayed and repeated regathering of local candidates on failed
// networks, where the delay in milliseconds is given by the config. Each // networks, where the delay in milliseconds is given by the config. Each
// repetition is separated by the same delay. When scheduled, all previous // repetition is separated by the same delay. When scheduled, all previous
@ -99,24 +84,16 @@ class BasicRegatheringController : public sigslot::has_slots<> {
// ScheduleRecurringRegatheringOnFailedNetworks. // ScheduleRecurringRegatheringOnFailedNetworks.
void CancelScheduledRecurringRegatheringOnFailedNetworks(); void CancelScheduledRecurringRegatheringOnFailedNetworks();
rtc::Thread* thread() const { return thread_; } // The following method perform the actual regathering, if the recent port
// The following two methods perform the actual regathering, if the recent // allocator session has done the initial gathering.
// port allocator session has done the initial gathering. void RegatherOnFailedNetworksIfDoneGathering();
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);
Config config_; Config config_;
cricket::IceTransportInternal* ice_transport_; cricket::IceTransportInternal* ice_transport_;
cricket::PortAllocatorSession* allocator_session_ = nullptr; cricket::PortAllocatorSession* allocator_session_ = nullptr;
bool has_recurring_schedule_on_all_networks_ = false;
bool has_recurring_schedule_on_failed_networks_ = false; bool has_recurring_schedule_on_failed_networks_ = false;
rtc::Thread* thread_; rtc::Thread* thread_;
rtc::AsyncInvoker invoker_for_all_networks_;
rtc::AsyncInvoker invoker_for_failed_networks_; rtc::AsyncInvoker invoker_for_failed_networks_;
// Used to generate random intervals for regather_all_networks_interval_range.
Random rand_;
}; };
} // namespace webrtc } // namespace webrtc

View file

@ -54,7 +54,8 @@ class RegatheringControllerTest : public ::testing::Test,
ice_transport_(new cricket::MockIceTransport()), ice_transport_(new cricket::MockIceTransport()),
allocator_( allocator_(
new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr)) { 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_controller_.reset(new BasicRegatheringController(
regathering_config, ice_transport_.get(), rtc::Thread::Current())); regathering_config, ice_transport_.get(), rtc::Thread::Current()));
} }
@ -121,15 +122,12 @@ TEST_F(RegatheringControllerTest,
rtc::ScopedFakeClock clock; rtc::ScopedFakeClock clock;
InitializeAndGatherOnce(); // Session not cleared. InitializeAndGatherOnce(); // Session not cleared.
rtc::IntervalRange regather_all_networks_interval_range(2000, 2000); BasicRegatheringController::Config config;
BasicRegatheringController::Config config( config.regather_on_failed_networks_interval = 2000;
regather_all_networks_interval_range, 2000);
regathering_controller()->SetConfig(config); regathering_controller()->SetConfig(config);
regathering_controller()->Start(); regathering_controller()->Start();
SIMULATED_WAIT(false, 10000, clock); SIMULATED_WAIT(false, 10000, clock);
// Expect no regathering in the last 10s. // Expect no regathering in the last 10s.
EXPECT_EQ(0, GetRegatheringReasonCount(
cricket::IceRegatheringReason::OCCASIONAL_REFRESH));
EXPECT_EQ(0, GetRegatheringReasonCount( EXPECT_EQ(0, GetRegatheringReasonCount(
cricket::IceRegatheringReason::NETWORK_FAILURE)); cricket::IceRegatheringReason::NETWORK_FAILURE));
} }
@ -138,149 +136,25 @@ TEST_F(RegatheringControllerTest, IceRegatheringRepeatsAsScheduled) {
rtc::ScopedFakeClock clock; rtc::ScopedFakeClock clock;
InitializeAndGatherOnceWithSessionCleared(); InitializeAndGatherOnceWithSessionCleared();
rtc::IntervalRange regather_all_networks_interval_range(2000, 2000); BasicRegatheringController::Config config;
BasicRegatheringController::Config config( config.regather_on_failed_networks_interval = 2000;
regather_all_networks_interval_range, 2000);
regathering_controller()->SetConfig(config); regathering_controller()->SetConfig(config);
regathering_controller()->Start(); regathering_controller()->Start();
SIMULATED_WAIT(false, 2000 - 1, clock); SIMULATED_WAIT(false, 2000 - 1, clock);
// Expect no regathering. // Expect no regathering.
EXPECT_EQ(0, GetRegatheringReasonCount(
cricket::IceRegatheringReason::OCCASIONAL_REFRESH));
EXPECT_EQ(0, GetRegatheringReasonCount( EXPECT_EQ(0, GetRegatheringReasonCount(
cricket::IceRegatheringReason::NETWORK_FAILURE)); cricket::IceRegatheringReason::NETWORK_FAILURE));
SIMULATED_WAIT(false, 2, clock); SIMULATED_WAIT(false, 2, clock);
// Expect regathering on all networks and on failed networks to happen once // Expect regathering on all networks and on failed networks to happen once
// respectively in that last 2s with 2s interval. // respectively in that last 2s with 2s interval.
EXPECT_EQ(1, GetRegatheringReasonCount(
cricket::IceRegatheringReason::OCCASIONAL_REFRESH));
EXPECT_EQ(1, GetRegatheringReasonCount( EXPECT_EQ(1, GetRegatheringReasonCount(
cricket::IceRegatheringReason::NETWORK_FAILURE)); cricket::IceRegatheringReason::NETWORK_FAILURE));
SIMULATED_WAIT(false, 11000, clock); SIMULATED_WAIT(false, 11000, clock);
// Expect regathering to happen for another 5 times in 11s with 2s interval. // 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( EXPECT_EQ(6, GetRegatheringReasonCount(
cricket::IceRegatheringReason::NETWORK_FAILURE)); 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 // Tests that the schedule of ICE regathering on failed networks can be canceled
// and replaced by a new recurring schedule. // and replaced by a new recurring schedule.
TEST_F(RegatheringControllerTest, TEST_F(RegatheringControllerTest,
@ -288,9 +162,8 @@ TEST_F(RegatheringControllerTest,
rtc::ScopedFakeClock clock; rtc::ScopedFakeClock clock;
InitializeAndGatherOnceWithSessionCleared(); InitializeAndGatherOnceWithSessionCleared();
rtc::IntervalRange regather_all_networks_interval_range(2000, 2000); BasicRegatheringController::Config config;
BasicRegatheringController::Config config( config.regather_on_failed_networks_interval = 2000;
regather_all_networks_interval_range, 2000);
regathering_controller()->SetConfig(config); regathering_controller()->SetConfig(config);
regathering_controller()->Start(); regathering_controller()->Start();
config.regather_on_failed_networks_interval = 5000; config.regather_on_failed_networks_interval = 5000;

View file

@ -17,6 +17,7 @@
#include "rtc_base/checks.h" #include "rtc_base/checks.h"
#include "rtc_base/helpers.h" #include "rtc_base/helpers.h"
#include "rtc_base/logging.h" #include "rtc_base/logging.h"
#include "rtc_base/string_encode.h"
#include "rtc_base/time_utils.h" // For TimeMillis #include "rtc_base/time_utils.h" // For TimeMillis
#include "system_wrappers/include/field_trial.h" #include "system_wrappers/include/field_trial.h"

View file

@ -463,23 +463,6 @@ void BasicPortAllocatorSession::RegatherOnFailedNetworks() {
IceRegatheringReason::NETWORK_FAILURE); IceRegatheringReason::NETWORK_FAILURE);
} }
void BasicPortAllocatorSession::RegatherOnAllNetworks() {
RTC_DCHECK_RUN_ON(network_thread_);
std::vector<rtc::Network*> 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( void BasicPortAllocatorSession::Regather(
const std::vector<rtc::Network*>& networks, const std::vector<rtc::Network*>& networks,
bool disable_equivalent_phases, bool disable_equivalent_phases,

View file

@ -141,7 +141,6 @@ class RTC_EXPORT BasicPortAllocatorSession : public PortAllocatorSession,
std::vector<Candidate> ReadyCandidates() const override; std::vector<Candidate> ReadyCandidates() const override;
bool CandidatesAllocationDone() const override; bool CandidatesAllocationDone() const override;
void RegatherOnFailedNetworks() override; void RegatherOnFailedNetworks() override;
void RegatherOnAllNetworks() override;
void GetCandidateStatsFromReadyPorts( void GetCandidateStatsFromReadyPorts(
CandidateStatsList* candidate_stats_list) const override; CandidateStatsList* candidate_stats_list) const override;
void SetStunKeepaliveIntervalForReadyPorts( void SetStunKeepaliveIntervalForReadyPorts(

View file

@ -892,7 +892,6 @@ bool PeerConnectionInterface::RTCConfiguration::operator==(
absl::optional<int> ice_unwritable_min_checks; absl::optional<int> ice_unwritable_min_checks;
absl::optional<int> ice_inactive_timeout; absl::optional<int> ice_inactive_timeout;
absl::optional<int> stun_candidate_keepalive_interval; absl::optional<int> stun_candidate_keepalive_interval;
absl::optional<rtc::IntervalRange> ice_regather_interval_range;
webrtc::TurnCustomizer* turn_customizer; webrtc::TurnCustomizer* turn_customizer;
SdpSemantics sdp_semantics; SdpSemantics sdp_semantics;
absl::optional<rtc::AdapterType> network_preference; absl::optional<rtc::AdapterType> network_preference;
@ -958,7 +957,6 @@ bool PeerConnectionInterface::RTCConfiguration::operator==(
ice_inactive_timeout == o.ice_inactive_timeout && ice_inactive_timeout == o.ice_inactive_timeout &&
stun_candidate_keepalive_interval == stun_candidate_keepalive_interval ==
o.stun_candidate_keepalive_interval && o.stun_candidate_keepalive_interval &&
ice_regather_interval_range == o.ice_regather_interval_range &&
turn_customizer == o.turn_customizer && turn_customizer == o.turn_customizer &&
sdp_semantics == o.sdp_semantics && sdp_semantics == o.sdp_semantics &&
network_preference == o.network_preference && network_preference == o.network_preference &&
@ -1424,15 +1422,8 @@ bool PeerConnection::Initialize(
RTCError PeerConnection::ValidateConfiguration( RTCError PeerConnection::ValidateConfiguration(
const RTCConfiguration& config) const { const RTCConfiguration& config) const {
if (config.ice_regather_interval_range && return cricket::P2PTransportChannel::ValidateIceConfig(
config.continual_gathering_policy == GATHER_ONCE) { ParseIceConfig(config));
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;
} }
rtc::scoped_refptr<StreamCollectionInterface> PeerConnection::local_streams() { rtc::scoped_refptr<StreamCollectionInterface> 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_unwritable_min_checks = config.ice_unwritable_min_checks;
ice_config.ice_inactive_timeout = config.ice_inactive_timeout; ice_config.ice_inactive_timeout = config.ice_inactive_timeout;
ice_config.stun_keepalive_interval = config.stun_candidate_keepalive_interval; 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; ice_config.network_preference = config.network_preference;
return ice_config; return ice_config;
} }

View file

@ -3666,28 +3666,6 @@ TEST_P(PeerConnectionInterfaceTest, SetBitrateMaxNegativeFails) {
EXPECT_FALSE(pc_->SetBitrate(bitrate).ok()); 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 // The current bitrate from BitrateSettings is currently clamped
// by Call's BitrateConstraints, which comes from the SDP or a default value. // 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 // This test checks that a call to SetBitrate with a current bitrate that will

View file

@ -11,6 +11,8 @@
#ifndef RTC_BASE_ASYNC_PACKET_SOCKET_H_ #ifndef RTC_BASE_ASYNC_PACKET_SOCKET_H_
#define RTC_BASE_ASYNC_PACKET_SOCKET_H_ #define RTC_BASE_ASYNC_PACKET_SOCKET_H_
#include <vector>
#include "rtc_base/constructor_magic.h" #include "rtc_base/constructor_magic.h"
#include "rtc_base/dscp.h" #include "rtc_base/dscp.h"
#include "rtc_base/network/sent_packet.h" #include "rtc_base/network/sent_packet.h"

View file

@ -14,10 +14,7 @@
#include <stdint.h> #include <stdint.h>
#include <time.h> #include <time.h>
#include <string>
#include "rtc_base/checks.h" #include "rtc_base/checks.h"
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/system/rtc_export.h" #include "rtc_base/system/rtc_export.h"
namespace rtc { namespace rtc {
@ -137,34 +134,6 @@ int64_t TimeUTCMicros();
// See above. // See above.
int64_t TimeUTCMillis(); 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 } // namespace rtc
#endif // RTC_BASE_TIME_UTILS_H_ #endif // RTC_BASE_TIME_UTILS_H_

View file

@ -13,6 +13,7 @@
#include <deque> #include <deque>
#include <map> #include <map>
#include <vector>
#include "rtc_base/checks.h" #include "rtc_base/checks.h"
#include "rtc_base/constructor_magic.h" #include "rtc_base/constructor_magic.h"

View file

@ -840,9 +840,6 @@ if (is_ios || is_mac) {
"objc/api/peerconnection/RTCIceServer+Private.h", "objc/api/peerconnection/RTCIceServer+Private.h",
"objc/api/peerconnection/RTCIceServer.h", "objc/api/peerconnection/RTCIceServer.h",
"objc/api/peerconnection/RTCIceServer.mm", "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+Private.h",
"objc/api/peerconnection/RTCLegacyStatsReport.h", "objc/api/peerconnection/RTCLegacyStatsReport.h",
"objc/api/peerconnection/RTCLegacyStatsReport.mm", "objc/api/peerconnection/RTCLegacyStatsReport.mm",
@ -1005,7 +1002,6 @@ if (is_ios || is_mac) {
"objc/Framework/Headers/WebRTC/RTCH264ProfileLevelId.h", "objc/Framework/Headers/WebRTC/RTCH264ProfileLevelId.h",
"objc/Framework/Headers/WebRTC/RTCIceCandidate.h", "objc/Framework/Headers/WebRTC/RTCIceCandidate.h",
"objc/Framework/Headers/WebRTC/RTCIceServer.h", "objc/Framework/Headers/WebRTC/RTCIceServer.h",
"objc/Framework/Headers/WebRTC/RTCIntervalRange.h",
"objc/Framework/Headers/WebRTC/RTCLegacyStatsReport.h", "objc/Framework/Headers/WebRTC/RTCLegacyStatsReport.h",
"objc/Framework/Headers/WebRTC/RTCLogging.h", "objc/Framework/Headers/WebRTC/RTCLogging.h",
"objc/Framework/Headers/WebRTC/RTCMTLNSVideoView.h", "objc/Framework/Headers/WebRTC/RTCMTLNSVideoView.h",
@ -1183,7 +1179,6 @@ if (is_ios || is_mac) {
"objc/unittests/RTCDataChannelConfigurationTest.mm", "objc/unittests/RTCDataChannelConfigurationTest.mm",
"objc/unittests/RTCIceCandidateTest.mm", "objc/unittests/RTCIceCandidateTest.mm",
"objc/unittests/RTCIceServerTest.mm", "objc/unittests/RTCIceServerTest.mm",
"objc/unittests/RTCIntervalRangeTests.mm",
"objc/unittests/RTCMediaConstraintsTest.mm", "objc/unittests/RTCMediaConstraintsTest.mm",
"objc/unittests/RTCPeerConnectionFactoryBuilderTest.mm", "objc/unittests/RTCPeerConnectionFactoryBuilderTest.mm",
"objc/unittests/RTCPeerConnectionTest.mm", "objc/unittests/RTCPeerConnectionTest.mm",
@ -1293,7 +1288,6 @@ if (is_ios || is_mac) {
"objc/api/peerconnection/RTCFieldTrials.h", "objc/api/peerconnection/RTCFieldTrials.h",
"objc/api/peerconnection/RTCIceCandidate.h", "objc/api/peerconnection/RTCIceCandidate.h",
"objc/api/peerconnection/RTCIceServer.h", "objc/api/peerconnection/RTCIceServer.h",
"objc/api/peerconnection/RTCIntervalRange.h",
"objc/api/peerconnection/RTCLegacyStatsReport.h", "objc/api/peerconnection/RTCLegacyStatsReport.h",
"objc/api/peerconnection/RTCMediaConstraints.h", "objc/api/peerconnection/RTCMediaConstraints.h",
"objc/api/peerconnection/RTCMediaSource.h", "objc/api/peerconnection/RTCMediaSource.h",
@ -1408,7 +1402,6 @@ if (is_ios || is_mac) {
"objc/api/peerconnection/RTCFieldTrials.h", "objc/api/peerconnection/RTCFieldTrials.h",
"objc/api/peerconnection/RTCIceCandidate.h", "objc/api/peerconnection/RTCIceCandidate.h",
"objc/api/peerconnection/RTCIceServer.h", "objc/api/peerconnection/RTCIceServer.h",
"objc/api/peerconnection/RTCIntervalRange.h",
"objc/api/peerconnection/RTCLegacyStatsReport.h", "objc/api/peerconnection/RTCLegacyStatsReport.h",
"objc/api/peerconnection/RTCMediaConstraints.h", "objc/api/peerconnection/RTCMediaConstraints.h",
"objc/api/peerconnection/RTCMediaSource.h", "objc/api/peerconnection/RTCMediaSource.h",

View file

@ -415,27 +415,6 @@ public class PeerConnection {
KEEP_FIRST_READY // Keep the first ready port and prune the rest on the same network. 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. * Java version of webrtc::SdpSemantics.
* *
@ -525,7 +504,6 @@ public class PeerConnection {
// //
// Can be set to Integer.MAX_VALUE to effectively disable the limit. // Can be set to Integer.MAX_VALUE to effectively disable the limit.
public int maxIPv6Networks; public int maxIPv6Networks;
@Nullable public IntervalRange iceRegatherIntervalRange;
// These values will be overridden by MediaStream constraints if deprecated constraints-based // These values will be overridden by MediaStream constraints if deprecated constraints-based
// create peerconnection interface is used. // create peerconnection interface is used.
@ -609,7 +587,6 @@ public class PeerConnection {
stunCandidateKeepaliveIntervalMs = null; stunCandidateKeepaliveIntervalMs = null;
disableIPv6OnWifi = false; disableIPv6OnWifi = false;
maxIPv6Networks = 5; maxIPv6Networks = 5;
iceRegatherIntervalRange = null;
disableIpv6 = false; disableIpv6 = false;
enableDscp = false; enableDscp = false;
enableCpuOveruseDetection = true; enableCpuOveruseDetection = true;
@ -765,12 +742,6 @@ public class PeerConnection {
return maxIPv6Networks; return maxIPv6Networks;
} }
@Nullable
@CalledByNative("RTCConfiguration")
IntervalRange getIceRegatherIntervalRange() {
return iceRegatherIntervalRange;
}
@Nullable @Nullable
@CalledByNative("RTCConfiguration") @CalledByNative("RTCConfiguration")
TurnCustomizer getTurnCustomizer() { TurnCustomizer getTurnCustomizer() {

View file

@ -168,7 +168,6 @@ public class PeerConnectionTest {
// Test configuration options. // Test configuration options.
config.continualGatheringPolicy = PeerConnection.ContinualGatheringPolicy.GATHER_CONTINUALLY; config.continualGatheringPolicy = PeerConnection.ContinualGatheringPolicy.GATHER_CONTINUALLY;
config.iceRegatherIntervalRange = new PeerConnection.IntervalRange(1000, 2000);
PeerConnection offeringPC = PeerConnection offeringPC =
factory.createPeerConnection(config, mock(PeerConnection.Observer.class)); factory.createPeerConnection(config, mock(PeerConnection.Observer.class));

View file

@ -240,13 +240,6 @@ void JavaToNativeRTCConfiguration(
Java_RTCConfiguration_getDisableIPv6OnWifi(jni, j_rtc_config); Java_RTCConfiguration_getDisableIPv6OnWifi(jni, j_rtc_config);
rtc_config->max_ipv6_networks = rtc_config->max_ipv6_networks =
Java_RTCConfiguration_getMaxIPv6Networks(jni, j_rtc_config); Java_RTCConfiguration_getMaxIPv6Networks(jni, j_rtc_config);
ScopedJavaLocalRef<jobject> 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); rtc_config->turn_customizer = GetNativeTurnCustomizer(jni, j_turn_customizer);

View file

@ -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"

View file

@ -15,7 +15,6 @@
#import "RTCMacros.h" #import "RTCMacros.h"
@class RTCIceServer; @class RTCIceServer;
@class RTCIntervalRange;
/** /**
* Represents the ice transport policy. This exposes the same states in C++, * 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; @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 /** Configure the SDP semantics used by this PeerConnection. Note that the
* WebRTC 1.0 specification requires UnifiedPlan semantics. The * WebRTC 1.0 specification requires UnifiedPlan semantics. The
* RTCRtpTransceiver API is only available with UnifiedPlan semantics. * RTCRtpTransceiver API is only available with UnifiedPlan semantics.

View file

@ -15,7 +15,6 @@
#import "RTCCertificate.h" #import "RTCCertificate.h"
#import "RTCConfiguration+Native.h" #import "RTCConfiguration+Native.h"
#import "RTCIceServer+Private.h" #import "RTCIceServer+Private.h"
#import "RTCIntervalRange+Private.h"
#import "base/RTCLogging.h" #import "base/RTCLogging.h"
#include "rtc_base/rtc_certificate_generator.h" #include "rtc_base/rtc_certificate_generator.h"
@ -48,7 +47,6 @@
@synthesize shouldSurfaceIceCandidatesOnIceTransportTypeChanged = @synthesize shouldSurfaceIceCandidatesOnIceTransportTypeChanged =
_shouldSurfaceIceCandidatesOnIceTransportTypeChanged; _shouldSurfaceIceCandidatesOnIceTransportTypeChanged;
@synthesize iceCheckMinInterval = _iceCheckMinInterval; @synthesize iceCheckMinInterval = _iceCheckMinInterval;
@synthesize iceRegatherIntervalRange = _iceRegatherIntervalRange;
@synthesize sdpSemantics = _sdpSemantics; @synthesize sdpSemantics = _sdpSemantics;
@synthesize turnCustomizer = _turnCustomizer; @synthesize turnCustomizer = _turnCustomizer;
@synthesize activeResetSrtpParams = _activeResetSrtpParams; @synthesize activeResetSrtpParams = _activeResetSrtpParams;
@ -118,11 +116,6 @@
_iceCheckMinInterval = _iceCheckMinInterval =
[NSNumber numberWithInt:*config.ice_check_min_interval]; [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]; _sdpSemantics = [[self class] sdpSemanticsForNativeSdpSemantics:config.sdp_semantics];
_turnCustomizer = config.turn_customizer; _turnCustomizer = config.turn_customizer;
_activeResetSrtpParams = config.active_reset_srtp_params; _activeResetSrtpParams = config.active_reset_srtp_params;
@ -147,7 +140,7 @@
- (NSString *)description { - (NSString *)description {
static NSString *formatString = @"RTCConfiguration: " 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" @"{\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 return [NSString
stringWithFormat:formatString, stringWithFormat:formatString,
@ -168,7 +161,6 @@
_shouldPresumeWritableWhenFullyRelayed, _shouldPresumeWritableWhenFullyRelayed,
_shouldSurfaceIceCandidatesOnIceTransportTypeChanged, _shouldSurfaceIceCandidatesOnIceTransportTypeChanged,
_iceCheckMinInterval, _iceCheckMinInterval,
_iceRegatherIntervalRange,
_disableLinkLocalNetworks, _disableLinkLocalNetworks,
_disableIPV6, _disableIPV6,
_disableIPV6OnWiFi, _disableIPV6OnWiFi,
@ -251,12 +243,6 @@
if (_iceCheckMinInterval != nil) { if (_iceCheckMinInterval != nil) {
nativeConfig->ice_check_min_interval = absl::optional<int>(_iceCheckMinInterval.intValue); nativeConfig->ice_check_min_interval = absl::optional<int>(_iceCheckMinInterval.intValue);
} }
if (_iceRegatherIntervalRange != nil) {
std::unique_ptr<rtc::IntervalRange> nativeIntervalRange(
_iceRegatherIntervalRange.nativeIntervalRange);
nativeConfig->ice_regather_interval_range =
absl::optional<rtc::IntervalRange>(*nativeIntervalRange);
}
nativeConfig->sdp_semantics = [[self class] nativeSdpSemanticsForSdpSemantics:_sdpSemantics]; nativeConfig->sdp_semantics = [[self class] nativeSdpSemanticsForSdpSemantics:_sdpSemantics];
if (_turnCustomizer) { if (_turnCustomizer) {
nativeConfig->turn_customizer = _turnCustomizer; nativeConfig->turn_customizer = _turnCustomizer;

View file

@ -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<rtc::IntervalRange> nativeIntervalRange;
- (instancetype)initWithNativeIntervalRange:(const rtc::IntervalRange &)config;
@end
NS_ASSUME_NONNULL_END

View file

@ -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 <Foundation/Foundation.h>
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

View file

@ -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<rtc::IntervalRange>)nativeIntervalRange {
std::unique_ptr<rtc::IntervalRange> nativeIntervalRange(
new rtc::IntervalRange((int)_min, (int)_max));
return nativeIntervalRange;
}
@end

View file

@ -17,7 +17,6 @@
#import "api/peerconnection/RTCConfiguration+Private.h" #import "api/peerconnection/RTCConfiguration+Private.h"
#import "api/peerconnection/RTCConfiguration.h" #import "api/peerconnection/RTCConfiguration.h"
#import "api/peerconnection/RTCIceServer.h" #import "api/peerconnection/RTCIceServer.h"
#import "api/peerconnection/RTCIntervalRange.h"
#import "helpers/NSString+StdString.h" #import "helpers/NSString+StdString.h"
@interface RTCConfigurationTest : NSObject @interface RTCConfigurationTest : NSObject
@ -30,7 +29,6 @@
- (void)testConversionToNativeConfiguration { - (void)testConversionToNativeConfiguration {
NSArray *urlStrings = @[ @"stun:stun1.example.net" ]; NSArray *urlStrings = @[ @"stun:stun1.example.net" ];
RTCIceServer *server = [[RTCIceServer alloc] initWithURLStrings:urlStrings]; RTCIceServer *server = [[RTCIceServer alloc] initWithURLStrings:urlStrings];
RTCIntervalRange *range = [[RTCIntervalRange alloc] initWithMin:0 max:100];
RTCConfiguration *config = [[RTCConfiguration alloc] init]; RTCConfiguration *config = [[RTCConfiguration alloc] init];
config.iceServers = @[ server ]; config.iceServers = @[ server ];
@ -49,7 +47,6 @@
config.continualGatheringPolicy = config.continualGatheringPolicy =
RTCContinualGatheringPolicyGatherContinually; RTCContinualGatheringPolicyGatherContinually;
config.shouldPruneTurnPorts = YES; config.shouldPruneTurnPorts = YES;
config.iceRegatherIntervalRange = range;
config.cryptoOptions = [[RTCCryptoOptions alloc] initWithSrtpEnableGcmCryptoSuites:YES config.cryptoOptions = [[RTCCryptoOptions alloc] initWithSrtpEnableGcmCryptoSuites:YES
srtpEnableAes128Sha1_32CryptoCipher:YES srtpEnableAes128Sha1_32CryptoCipher:YES
srtpEnableEncryptedRtpHeaderExtensions:YES srtpEnableEncryptedRtpHeaderExtensions:YES
@ -82,8 +79,6 @@
EXPECT_EQ(webrtc::PeerConnectionInterface::GATHER_CONTINUALLY, EXPECT_EQ(webrtc::PeerConnectionInterface::GATHER_CONTINUALLY,
nativeConfig->continual_gathering_policy); nativeConfig->continual_gathering_policy);
EXPECT_EQ(true, nativeConfig->prune_turn_ports); 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_gcm_crypto_suites);
EXPECT_EQ(true, nativeConfig->crypto_options->srtp.enable_aes128_sha1_32_crypto_cipher); 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); EXPECT_EQ(true, nativeConfig->crypto_options->srtp.enable_encrypted_rtp_header_extensions);
@ -95,7 +90,6 @@
- (void)testNativeConversionToConfiguration { - (void)testNativeConversionToConfiguration {
NSArray *urlStrings = @[ @"stun:stun1.example.net" ]; NSArray *urlStrings = @[ @"stun:stun1.example.net" ];
RTCIceServer *server = [[RTCIceServer alloc] initWithURLStrings:urlStrings]; RTCIceServer *server = [[RTCIceServer alloc] initWithURLStrings:urlStrings];
RTCIntervalRange *range = [[RTCIntervalRange alloc] initWithMin:0 max:100];
RTCConfiguration *config = [[RTCConfiguration alloc] init]; RTCConfiguration *config = [[RTCConfiguration alloc] init];
config.iceServers = @[ server ]; config.iceServers = @[ server ];
@ -114,7 +108,6 @@
config.continualGatheringPolicy = config.continualGatheringPolicy =
RTCContinualGatheringPolicyGatherContinually; RTCContinualGatheringPolicyGatherContinually;
config.shouldPruneTurnPorts = YES; config.shouldPruneTurnPorts = YES;
config.iceRegatherIntervalRange = range;
config.cryptoOptions = [[RTCCryptoOptions alloc] initWithSrtpEnableGcmCryptoSuites:YES config.cryptoOptions = [[RTCCryptoOptions alloc] initWithSrtpEnableGcmCryptoSuites:YES
srtpEnableAes128Sha1_32CryptoCipher:NO srtpEnableAes128Sha1_32CryptoCipher:NO
srtpEnableEncryptedRtpHeaderExtensions:NO srtpEnableEncryptedRtpHeaderExtensions:NO
@ -146,8 +139,6 @@
newConfig.iceBackupCandidatePairPingInterval); newConfig.iceBackupCandidatePairPingInterval);
EXPECT_EQ(config.continualGatheringPolicy, newConfig.continualGatheringPolicy); EXPECT_EQ(config.continualGatheringPolicy, newConfig.continualGatheringPolicy);
EXPECT_EQ(config.shouldPruneTurnPorts, newConfig.shouldPruneTurnPorts); 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, EXPECT_EQ(config.cryptoOptions.srtpEnableGcmCryptoSuites,
newConfig.cryptoOptions.srtpEnableGcmCryptoSuites); newConfig.cryptoOptions.srtpEnableGcmCryptoSuites);
EXPECT_EQ(config.cryptoOptions.srtpEnableAes128Sha1_32CryptoCipher, EXPECT_EQ(config.cryptoOptions.srtpEnableAes128Sha1_32CryptoCipher,

View file

@ -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 <Foundation/Foundation.h>
#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<rtc::IntervalRange> 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];
}
}