Rename IceControllerEvent to IceRecheckEvent 3/n

This changes renames the event to better suit its purpose. An alias
with the old name is added for compatibility pending internal cleanup.

Bug: webrtc:14125, webrtc:14131
Change-Id: I87026e19f2620eaa6a6770dcbedf1d0399c6c6b0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264149
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Cr-Commit-Position: refs/heads/main@{#37111}
This commit is contained in:
Sameer Vijaykar
2022-06-03 11:39:39 +02:00
committed by WebRTC LUCI CQ
parent 3656581ade
commit 2a1accd5e6
3 changed files with 36 additions and 34 deletions

View File

@ -465,7 +465,7 @@ BasicIceController::HandleInitialSelectDampening(
RTC_LOG(LS_INFO) << "delay initial selection up to " << min_delay << "ms";
return {.connection = absl::nullopt,
.recheck_event = IceControllerEvent(
.recheck_event = IceRecheckEvent(
IceSwitchReason::ICE_CONTROLLER_RECHECK, min_delay)};
}
@ -496,7 +496,7 @@ IceControllerInterface::SwitchResult BasicIceController::ShouldSwitchConnection(
receiving_unchanged_threshold,
&missed_receiving_unchanged_threshold);
absl::optional<IceControllerEvent> recheck_event;
absl::optional<IceRecheckEvent> recheck_event;
if (missed_receiving_unchanged_threshold &&
config_.receiving_switching_delay_or_default()) {
// If we do not switch to the connection because it missed the receiving

View File

@ -16,7 +16,7 @@
namespace cricket {
std::string IceControllerEvent::ToString() const {
std::string IceRecheckEvent::ToString() const {
std::string str = IceSwitchReasonToString(reason);
if (recheck_delay_ms) {
str += " (after delay: " + std::to_string(recheck_delay_ms) + ")";
@ -26,55 +26,55 @@ std::string IceControllerEvent::ToString() const {
// TODO(bugs.webrtc.org/14125) remove when Type is replaced with
// IceSwitchReason.
IceControllerEvent::Type IceControllerEvent::FromIceSwitchReason(
IceRecheckEvent::Type IceRecheckEvent::FromIceSwitchReason(
IceSwitchReason reason) {
switch (reason) {
case IceSwitchReason::REMOTE_CANDIDATE_GENERATION_CHANGE:
return IceControllerEvent::REMOTE_CANDIDATE_GENERATION_CHANGE;
return IceRecheckEvent::REMOTE_CANDIDATE_GENERATION_CHANGE;
case IceSwitchReason::NETWORK_PREFERENCE_CHANGE:
return IceControllerEvent::NETWORK_PREFERENCE_CHANGE;
return IceRecheckEvent::NETWORK_PREFERENCE_CHANGE;
case IceSwitchReason::NEW_CONNECTION_FROM_LOCAL_CANDIDATE:
return IceControllerEvent::NEW_CONNECTION_FROM_LOCAL_CANDIDATE;
return IceRecheckEvent::NEW_CONNECTION_FROM_LOCAL_CANDIDATE;
case IceSwitchReason::NEW_CONNECTION_FROM_REMOTE_CANDIDATE:
return IceControllerEvent::NEW_CONNECTION_FROM_REMOTE_CANDIDATE;
return IceRecheckEvent::NEW_CONNECTION_FROM_REMOTE_CANDIDATE;
case IceSwitchReason::NEW_CONNECTION_FROM_UNKNOWN_REMOTE_ADDRESS:
return IceControllerEvent::NEW_CONNECTION_FROM_UNKNOWN_REMOTE_ADDRESS;
return IceRecheckEvent::NEW_CONNECTION_FROM_UNKNOWN_REMOTE_ADDRESS;
case IceSwitchReason::NOMINATION_ON_CONTROLLED_SIDE:
return IceControllerEvent::NOMINATION_ON_CONTROLLED_SIDE;
return IceRecheckEvent::NOMINATION_ON_CONTROLLED_SIDE;
case IceSwitchReason::DATA_RECEIVED:
return IceControllerEvent::DATA_RECEIVED;
return IceRecheckEvent::DATA_RECEIVED;
case IceSwitchReason::CONNECT_STATE_CHANGE:
return IceControllerEvent::CONNECT_STATE_CHANGE;
return IceRecheckEvent::CONNECT_STATE_CHANGE;
case IceSwitchReason::SELECTED_CONNECTION_DESTROYED:
return IceControllerEvent::SELECTED_CONNECTION_DESTROYED;
return IceRecheckEvent::SELECTED_CONNECTION_DESTROYED;
case IceSwitchReason::ICE_CONTROLLER_RECHECK:
return IceControllerEvent::ICE_CONTROLLER_RECHECK;
return IceRecheckEvent::ICE_CONTROLLER_RECHECK;
}
}
// TODO(bugs.webrtc.org/14125) remove when Type is replaced with
// IceSwitchReason.
IceSwitchReason IceControllerEvent::FromType(IceControllerEvent::Type type) {
IceSwitchReason IceRecheckEvent::FromType(IceRecheckEvent::Type type) {
switch (type) {
case IceControllerEvent::REMOTE_CANDIDATE_GENERATION_CHANGE:
case IceRecheckEvent::REMOTE_CANDIDATE_GENERATION_CHANGE:
return IceSwitchReason::REMOTE_CANDIDATE_GENERATION_CHANGE;
case IceControllerEvent::NETWORK_PREFERENCE_CHANGE:
case IceRecheckEvent::NETWORK_PREFERENCE_CHANGE:
return IceSwitchReason::NETWORK_PREFERENCE_CHANGE;
case IceControllerEvent::NEW_CONNECTION_FROM_LOCAL_CANDIDATE:
case IceRecheckEvent::NEW_CONNECTION_FROM_LOCAL_CANDIDATE:
return IceSwitchReason::NEW_CONNECTION_FROM_LOCAL_CANDIDATE;
case IceControllerEvent::NEW_CONNECTION_FROM_REMOTE_CANDIDATE:
case IceRecheckEvent::NEW_CONNECTION_FROM_REMOTE_CANDIDATE:
return IceSwitchReason::NEW_CONNECTION_FROM_REMOTE_CANDIDATE;
case IceControllerEvent::NEW_CONNECTION_FROM_UNKNOWN_REMOTE_ADDRESS:
case IceRecheckEvent::NEW_CONNECTION_FROM_UNKNOWN_REMOTE_ADDRESS:
return IceSwitchReason::NEW_CONNECTION_FROM_UNKNOWN_REMOTE_ADDRESS;
case IceControllerEvent::NOMINATION_ON_CONTROLLED_SIDE:
case IceRecheckEvent::NOMINATION_ON_CONTROLLED_SIDE:
return IceSwitchReason::NOMINATION_ON_CONTROLLED_SIDE;
case IceControllerEvent::DATA_RECEIVED:
case IceRecheckEvent::DATA_RECEIVED:
return IceSwitchReason::DATA_RECEIVED;
case IceControllerEvent::CONNECT_STATE_CHANGE:
case IceRecheckEvent::CONNECT_STATE_CHANGE:
return IceSwitchReason::CONNECT_STATE_CHANGE;
case IceControllerEvent::SELECTED_CONNECTION_DESTROYED:
case IceRecheckEvent::SELECTED_CONNECTION_DESTROYED:
return IceSwitchReason::SELECTED_CONNECTION_DESTROYED;
case IceControllerEvent::ICE_CONTROLLER_RECHECK:
case IceRecheckEvent::ICE_CONTROLLER_RECHECK:
return IceSwitchReason::ICE_CONTROLLER_RECHECK;
}
}

View File

@ -24,7 +24,7 @@ namespace cricket {
struct IceFieldTrials; // Forward declaration to avoid circular dependency.
struct IceControllerEvent {
struct IceRecheckEvent {
// TODO(bugs.webrtc.org/14125) replace with IceSwitchReason.
enum Type {
REMOTE_CANDIDATE_GENERATION_CHANGE,
@ -42,11 +42,11 @@ struct IceControllerEvent {
ICE_CONTROLLER_RECHECK,
};
[[deprecated("bugs.webrtc.org/14125")]] IceControllerEvent(
[[deprecated("bugs.webrtc.org/14125")]] IceRecheckEvent(
const Type& _type) // NOLINT: runtime/explicit
: type(_type), reason(FromType(_type)) {}
IceControllerEvent(IceSwitchReason _reason, int _recheck_delay_ms)
IceRecheckEvent(IceSwitchReason _reason, int _recheck_delay_ms)
: type(FromIceSwitchReason(_reason)),
reason(_reason),
recheck_delay_ms(_recheck_delay_ms) {}
@ -62,6 +62,9 @@ struct IceControllerEvent {
int recheck_delay_ms = 0;
};
// TODO(bugs.webrtc.org/14125): remove.
using IceControllerEvent = IceRecheckEvent;
// Defines the interface for a module that control
// - which connection to ping
// - which connection to use
@ -93,7 +96,7 @@ class IceControllerInterface {
absl::optional<const Connection*> connection;
// An optional recheck event for when a Switch() should be attempted again.
absl::optional<IceControllerEvent> recheck_event;
absl::optional<IceRecheckEvent> recheck_event;
// A vector with connection to run ForgetLearnedState on.
std::vector<const Connection*> connections_to_forget_state_on;
@ -152,9 +155,8 @@ class IceControllerInterface {
// This method is called for IceSwitchReasons that can switch directly
// i.e without resorting.
[[deprecated("bugs.webrtc.org/14125")]] virtual SwitchResult
ShouldSwitchConnection(IceControllerEvent reason,
const Connection* connection) {
return ShouldSwitchConnection(IceControllerEvent::FromType(reason.type),
ShouldSwitchConnection(IceRecheckEvent reason, const Connection* connection) {
return ShouldSwitchConnection(IceRecheckEvent::FromType(reason.type),
connection);
}
virtual SwitchResult ShouldSwitchConnection(IceSwitchReason reason,
@ -162,8 +164,8 @@ class IceControllerInterface {
// Sort connections and check if we should switch.
[[deprecated("bugs.webrtc.org/14125")]] virtual SwitchResult
SortAndSwitchConnection(IceControllerEvent reason) {
return SortAndSwitchConnection(IceControllerEvent::FromType(reason.type));
SortAndSwitchConnection(IceRecheckEvent reason) {
return SortAndSwitchConnection(IceRecheckEvent::FromType(reason.type));
}
virtual SwitchResult SortAndSwitchConnection(IceSwitchReason reason) = 0;