diff --git a/p2p/base/basic_ice_controller.cc b/p2p/base/basic_ice_controller.cc index edd5681f5f..1695b075b3 100644 --- a/p2p/base/basic_ice_controller.cc +++ b/p2p/base/basic_ice_controller.cc @@ -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 recheck_event; + absl::optional 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 diff --git a/p2p/base/ice_controller_interface.cc b/p2p/base/ice_controller_interface.cc index 9eae922d2e..b0719c9073 100644 --- a/p2p/base/ice_controller_interface.cc +++ b/p2p/base/ice_controller_interface.cc @@ -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; } } diff --git a/p2p/base/ice_controller_interface.h b/p2p/base/ice_controller_interface.h index dad2b70c6e..5ec5e5a722 100644 --- a/p2p/base/ice_controller_interface.h +++ b/p2p/base/ice_controller_interface.h @@ -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 connection; // An optional recheck event for when a Switch() should be attempted again. - absl::optional recheck_event; + absl::optional recheck_event; // A vector with connection to run ForgetLearnedState on. std::vector 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;