Land refactored IceControllerEvent as IceRecheckEvent 4/4

This change removes the following after internal cleanup:
- IceRecheckEvent::Type enum, replaced with IceSwitchReason
- IceControllerEvent alias for IceRecheckEvent

Bug: webrtc:14125, webrtc:14131
Change-Id: I07bfeb7fa8a9c4d4a3f940213befd6418dfd6644
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264145
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Cr-Commit-Position: refs/heads/main@{#37118}
This commit is contained in:
Sameer Vijaykar 2022-06-03 14:03:18 +02:00 committed by WebRTC LUCI CQ
parent 6d122623ef
commit 9a91286898
2 changed files with 2 additions and 97 deletions

View File

@ -24,59 +24,4 @@ std::string IceRecheckEvent::ToString() const {
return str;
}
// TODO(bugs.webrtc.org/14125) remove when Type is replaced with
// IceSwitchReason.
IceRecheckEvent::Type IceRecheckEvent::FromIceSwitchReason(
IceSwitchReason reason) {
switch (reason) {
case IceSwitchReason::REMOTE_CANDIDATE_GENERATION_CHANGE:
return IceRecheckEvent::REMOTE_CANDIDATE_GENERATION_CHANGE;
case IceSwitchReason::NETWORK_PREFERENCE_CHANGE:
return IceRecheckEvent::NETWORK_PREFERENCE_CHANGE;
case IceSwitchReason::NEW_CONNECTION_FROM_LOCAL_CANDIDATE:
return IceRecheckEvent::NEW_CONNECTION_FROM_LOCAL_CANDIDATE;
case IceSwitchReason::NEW_CONNECTION_FROM_REMOTE_CANDIDATE:
return IceRecheckEvent::NEW_CONNECTION_FROM_REMOTE_CANDIDATE;
case IceSwitchReason::NEW_CONNECTION_FROM_UNKNOWN_REMOTE_ADDRESS:
return IceRecheckEvent::NEW_CONNECTION_FROM_UNKNOWN_REMOTE_ADDRESS;
case IceSwitchReason::NOMINATION_ON_CONTROLLED_SIDE:
return IceRecheckEvent::NOMINATION_ON_CONTROLLED_SIDE;
case IceSwitchReason::DATA_RECEIVED:
return IceRecheckEvent::DATA_RECEIVED;
case IceSwitchReason::CONNECT_STATE_CHANGE:
return IceRecheckEvent::CONNECT_STATE_CHANGE;
case IceSwitchReason::SELECTED_CONNECTION_DESTROYED:
return IceRecheckEvent::SELECTED_CONNECTION_DESTROYED;
case IceSwitchReason::ICE_CONTROLLER_RECHECK:
return IceRecheckEvent::ICE_CONTROLLER_RECHECK;
}
}
// TODO(bugs.webrtc.org/14125) remove when Type is replaced with
// IceSwitchReason.
IceSwitchReason IceRecheckEvent::FromType(IceRecheckEvent::Type type) {
switch (type) {
case IceRecheckEvent::REMOTE_CANDIDATE_GENERATION_CHANGE:
return IceSwitchReason::REMOTE_CANDIDATE_GENERATION_CHANGE;
case IceRecheckEvent::NETWORK_PREFERENCE_CHANGE:
return IceSwitchReason::NETWORK_PREFERENCE_CHANGE;
case IceRecheckEvent::NEW_CONNECTION_FROM_LOCAL_CANDIDATE:
return IceSwitchReason::NEW_CONNECTION_FROM_LOCAL_CANDIDATE;
case IceRecheckEvent::NEW_CONNECTION_FROM_REMOTE_CANDIDATE:
return IceSwitchReason::NEW_CONNECTION_FROM_REMOTE_CANDIDATE;
case IceRecheckEvent::NEW_CONNECTION_FROM_UNKNOWN_REMOTE_ADDRESS:
return IceSwitchReason::NEW_CONNECTION_FROM_UNKNOWN_REMOTE_ADDRESS;
case IceRecheckEvent::NOMINATION_ON_CONTROLLED_SIDE:
return IceSwitchReason::NOMINATION_ON_CONTROLLED_SIDE;
case IceRecheckEvent::DATA_RECEIVED:
return IceSwitchReason::DATA_RECEIVED;
case IceRecheckEvent::CONNECT_STATE_CHANGE:
return IceSwitchReason::CONNECT_STATE_CHANGE;
case IceRecheckEvent::SELECTED_CONNECTION_DESTROYED:
return IceSwitchReason::SELECTED_CONNECTION_DESTROYED;
case IceRecheckEvent::ICE_CONTROLLER_RECHECK:
return IceSwitchReason::ICE_CONTROLLER_RECHECK;
}
}
} // namespace cricket

View File

@ -25,46 +25,15 @@ namespace cricket {
struct IceFieldTrials; // Forward declaration to avoid circular dependency.
struct IceRecheckEvent {
// TODO(bugs.webrtc.org/14125) replace with IceSwitchReason.
enum Type {
REMOTE_CANDIDATE_GENERATION_CHANGE,
NETWORK_PREFERENCE_CHANGE,
NEW_CONNECTION_FROM_LOCAL_CANDIDATE,
NEW_CONNECTION_FROM_REMOTE_CANDIDATE,
NEW_CONNECTION_FROM_UNKNOWN_REMOTE_ADDRESS,
NOMINATION_ON_CONTROLLED_SIDE,
DATA_RECEIVED,
CONNECT_STATE_CHANGE,
SELECTED_CONNECTION_DESTROYED,
// The ICE_CONTROLLER_RECHECK enum value lets an IceController request
// P2PTransportChannel to recheck a switch periodically without an event
// taking place.
ICE_CONTROLLER_RECHECK,
};
[[deprecated("bugs.webrtc.org/14125")]] IceRecheckEvent(
const Type& _type) // NOLINT: runtime/explicit
: type(_type), reason(FromType(_type)) {}
IceRecheckEvent(IceSwitchReason _reason, int _recheck_delay_ms)
: type(FromIceSwitchReason(_reason)),
reason(_reason),
recheck_delay_ms(_recheck_delay_ms) {}
static Type FromIceSwitchReason(IceSwitchReason reason);
static IceSwitchReason FromType(Type type);
: reason(_reason), recheck_delay_ms(_recheck_delay_ms) {}
std::string ToString() const;
// TODO(bugs.webrtc.org/14125) replace usage with IceSwitchReason.
Type type;
IceSwitchReason reason;
int recheck_delay_ms = 0;
int recheck_delay_ms;
};
// 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
@ -154,19 +123,10 @@ class IceControllerInterface {
// Check if we should switch to `connection`.
// This method is called for IceSwitchReasons that can switch directly
// i.e without resorting.
[[deprecated("bugs.webrtc.org/14125")]] virtual SwitchResult
ShouldSwitchConnection(IceRecheckEvent reason, const Connection* connection) {
return ShouldSwitchConnection(IceRecheckEvent::FromType(reason.type),
connection);
}
virtual SwitchResult ShouldSwitchConnection(IceSwitchReason reason,
const Connection* connection) = 0;
// Sort connections and check if we should switch.
[[deprecated("bugs.webrtc.org/14125")]] virtual SwitchResult
SortAndSwitchConnection(IceRecheckEvent reason) {
return SortAndSwitchConnection(IceRecheckEvent::FromType(reason.type));
}
virtual SwitchResult SortAndSwitchConnection(IceSwitchReason reason) = 0;
// Prune connections.