diff --git a/p2p/base/p2p_transport_channel.cc b/p2p/base/p2p_transport_channel.cc index 263f6912be..f9c3068d0f 100644 --- a/p2p/base/p2p_transport_channel.cc +++ b/p2p/base/p2p_transport_channel.cc @@ -94,15 +94,6 @@ rtc::RouteEndpoint CreateRouteEndpointFromCandidate( uses_turn); } -bool UseActiveIceControllerFieldTrialEnabled( - const webrtc::FieldTrialsView* field_trials) { - // Feature to refactor ICE controller and enable active ICE controllers. - // Default enable for full launch. - // TODO(bugs.webrtc.org/14367): Code branching will be cleaned up in a - // follow-up CL. - return true; -} - using ::webrtc::RTCError; using ::webrtc::RTCErrorType; using ::webrtc::SafeTask; @@ -182,7 +173,6 @@ P2PTransportChannel::P2PTransportChannel( network_thread_(rtc::Thread::Current()), incoming_only_(false), error_(0), - sort_dirty_(false), remote_ice_mode_(ICEMODE_FULL), ice_role_(ICEROLE_UNKNOWN), tiebreaker_(0), @@ -224,9 +214,15 @@ P2PTransportChannel::P2PTransportChannel( &ice_field_trials_, field_trials ? field_trials->Lookup("WebRTC-IceControllerFieldTrials") : ""}; - ice_adapter_ = std::make_unique( - args, ice_controller_factory, active_ice_controller_factory, field_trials, - /* transport= */ this); + + if (active_ice_controller_factory) { + ActiveIceControllerFactoryArgs active_args{args, + /* ice_agent= */ this}; + ice_controller_ = active_ice_controller_factory->Create(active_args); + } else { + ice_controller_ = std::make_unique( + /* ice_agent= */ this, ice_controller_factory, args); + } } P2PTransportChannel::~P2PTransportChannel() { @@ -294,49 +290,7 @@ void P2PTransportChannel::AddConnection(Connection* connection) { webrtc::IceCandidatePairConfigType::kAdded); connections_.push_back(connection); - ice_adapter_->OnConnectionAdded(connection); -} - -// TODO(bugs.webrtc.org/14367) remove once refactor lands. -bool P2PTransportChannel::MaybeSwitchSelectedConnection( - const Connection* new_connection, - IceSwitchReason reason) { - RTC_DCHECK_RUN_ON(network_thread_); - - return MaybeSwitchSelectedConnection( - reason, - ice_adapter_->LegacyShouldSwitchConnection(reason, new_connection)); -} - -// TODO(bugs.webrtc.org/14367) remove once refactor lands. -bool P2PTransportChannel::MaybeSwitchSelectedConnection( - IceSwitchReason reason, - IceControllerInterface::SwitchResult result) { - RTC_DCHECK_RUN_ON(network_thread_); - if (result.connection.has_value()) { - RTC_LOG(LS_INFO) << "Switching selected connection due to: " - << IceSwitchReasonToString(reason); - SwitchSelectedConnection(FromIceController(*result.connection), reason); - } - - if (result.recheck_event.has_value()) { - // If we do not switch to the connection because it missed the receiving - // threshold, the new connection is in a better receiving state than the - // currently selected connection. So we need to re-check whether it needs - // to be switched at a later time. - network_thread_->PostDelayedTask( - SafeTask(task_safety_.flag(), - [this, reason = result.recheck_event->reason]() { - SortConnectionsAndUpdateState(reason); - }), - TimeDelta::Millis(result.recheck_event->recheck_delay_ms)); - } - - for (const auto* con : result.connections_to_forget_state_on) { - FromIceController(con)->ForgetLearnedState(); - } - - return result.connection.has_value(); + ice_controller_->OnConnectionAdded(connection); } void P2PTransportChannel::ForgetLearnedStateForConnections( @@ -545,7 +499,7 @@ void P2PTransportChannel::SetRemoteIceParameters( ice_params, static_cast(remote_ice_parameters_.size() - 1)); } // Updating the remote ICE candidate generation could change the sort order. - ice_adapter_->OnSortAndSwitchRequest( + ice_controller_->OnSortAndSwitchRequest( IceSwitchReason::REMOTE_CANDIDATE_GENERATION_CHANGE); } @@ -700,7 +654,7 @@ void P2PTransportChannel::SetIceConfig(const IceConfig& config) { if (config_.network_preference != config.network_preference) { config_.network_preference = config.network_preference; - ice_adapter_->OnSortAndSwitchRequest( + ice_controller_->OnSortAndSwitchRequest( IceSwitchReason::NETWORK_PREFERENCE_CHANGE); RTC_LOG(LS_INFO) << "Set network preference to " << (config_.network_preference.has_value() @@ -727,7 +681,7 @@ void P2PTransportChannel::SetIceConfig(const IceConfig& config) { config_.vpn_preference = config.vpn_preference; allocator_->SetVpnPreference(config_.vpn_preference); - ice_adapter_->SetIceConfig(config_); + ice_controller_->SetIceConfig(config_); RTC_DCHECK(ValidateIceConfig(config_).ok()); } @@ -1004,7 +958,7 @@ void P2PTransportChannel::OnPortReady(PortAllocatorSession* session, CreateConnection(port, *iter, iter->origin_port()); } - ice_adapter_->OnImmediateSortAndSwitchRequest( + ice_controller_->OnImmediateSortAndSwitchRequest( IceSwitchReason::NEW_CONNECTION_FROM_LOCAL_CANDIDATE); } @@ -1184,7 +1138,7 @@ void P2PTransportChannel::OnUnknownAddress(PortInterface* port, // Update the list of connections since we just added another. We do this // after sending the response since it could (in principle) delete the // connection in question. - ice_adapter_->OnImmediateSortAndSwitchRequest( + ice_controller_->OnImmediateSortAndSwitchRequest( IceSwitchReason::NEW_CONNECTION_FROM_UNKNOWN_REMOTE_ADDRESS); } @@ -1235,11 +1189,11 @@ void P2PTransportChannel::OnNominated(Connection* conn) { // TODO(qingsi): RequestSortAndStateUpdate will eventually call // MaybeSwitchSelectedConnection again. Rewrite this logic. - if (ice_adapter_->OnImmediateSwitchRequest( + if (ice_controller_->OnImmediateSwitchRequest( IceSwitchReason::NOMINATION_ON_CONTROLLED_SIDE, conn)) { // Now that we have selected a connection, it is time to prune other // connections and update the read/write state of the channel. - ice_adapter_->OnSortAndSwitchRequest( + ice_controller_->OnSortAndSwitchRequest( IceSwitchReason::NOMINATION_ON_CONTROLLED_SIDE); } else { RTC_LOG(LS_INFO) @@ -1388,7 +1342,7 @@ void P2PTransportChannel::FinishAddingRemoteCandidate( CreateConnections(new_remote_candidate, NULL); // Resort the connections list, which may have new elements. - ice_adapter_->OnImmediateSortAndSwitchRequest( + ice_controller_->OnImmediateSortAndSwitchRequest( IceSwitchReason::NEW_CONNECTION_FROM_REMOTE_CANDIDATE); } @@ -1708,7 +1662,8 @@ rtc::DiffServCodePoint P2PTransportChannel::DefaultDscpValue() const { rtc::ArrayView P2PTransportChannel::connections() const { RTC_DCHECK_RUN_ON(network_thread_); - return ice_adapter_->LegacyConnections(); + return rtc::ArrayView( + const_cast(connections_.data()), connections_.size()); } void P2PTransportChannel::RemoveConnectionForTest(Connection* connection) { @@ -1738,38 +1693,6 @@ void P2PTransportChannel::UpdateConnectionStates() { } } -// Prepare for best candidate sorting. -// TODO(bugs.webrtc.org/14367) remove once refactor lands. -void P2PTransportChannel::RequestSortAndStateUpdate( - IceSwitchReason reason_to_sort) { - RTC_DCHECK_RUN_ON(network_thread_); - if (!sort_dirty_) { - network_thread_->PostTask( - SafeTask(task_safety_.flag(), [this, reason_to_sort]() { - SortConnectionsAndUpdateState(reason_to_sort); - })); - sort_dirty_ = true; - } -} - -// TODO(bugs.webrtc.org/14367) remove once refactor lands. -void P2PTransportChannel::MaybeStartPinging() { - RTC_DCHECK_RUN_ON(network_thread_); - if (started_pinging_) { - return; - } - - if (ice_adapter_->LegacyHasPingableConnection()) { - RTC_LOG(LS_INFO) << ToString() - << ": Have a pingable connection for the first time; " - "starting to ping."; - network_thread_->PostTask( - SafeTask(task_safety_.flag(), [this]() { CheckAndPing(); })); - regathering_controller_->Start(); - started_pinging_ = true; - } -} - void P2PTransportChannel::OnStartedPinging() { RTC_DCHECK_RUN_ON(network_thread_); RTC_LOG(LS_INFO) << ToString() @@ -1797,63 +1720,6 @@ bool P2PTransportChannel::PresumedWritable(const Connection* conn) const { conn->remote_candidate().type() == PRFLX_PORT_TYPE)); } -// Sort the available connections to find the best one. We also monitor -// the number of available connections and the current state. -// TODO(bugs.webrtc.org/14367) remove once refactor lands. -void P2PTransportChannel::SortConnectionsAndUpdateState( - IceSwitchReason reason_to_sort) { - RTC_DCHECK_RUN_ON(network_thread_); - - // Make sure the connection states are up-to-date since this affects how they - // will be sorted. - UpdateConnectionStates(); - - // Any changes after this point will require a re-sort. - sort_dirty_ = false; - - // If necessary, switch to the new choice. Note that `top_connection` doesn't - // have to be writable to become the selected connection although it will - // have higher priority if it is writable. - MaybeSwitchSelectedConnection( - reason_to_sort, - ice_adapter_->LegacySortAndSwitchConnection(reason_to_sort)); - - // The controlled side can prune only if the selected connection has been - // nominated because otherwise it may prune the connection that will be - // selected by the controlling side. - // TODO(honghaiz): This is not enough to prevent a connection from being - // pruned too early because with aggressive nomination, the controlling side - // will nominate every connection until it becomes writable. - if (AllowedToPruneConnections()) { - PruneConnections(); - } - - // Check if all connections are timedout. - bool all_connections_timedout = true; - for (const Connection* conn : connections()) { - if (conn->write_state() != Connection::STATE_WRITE_TIMEOUT) { - all_connections_timedout = false; - break; - } - } - - // Now update the writable state of the channel with the information we have - // so far. - if (all_connections_timedout) { - HandleAllTimedOut(); - } - - // Update the state of this channel. - UpdateTransportState(); - - // Also possibly start pinging. - // We could start pinging if: - // * The first connection was created. - // * ICE credentials were provided. - // * A TCP connection became connected. - MaybeStartPinging(); -} - void P2PTransportChannel::UpdateState() { // Check if all connections are timedout. bool all_connections_timedout = true; @@ -1880,14 +1746,6 @@ bool P2PTransportChannel::AllowedToPruneConnections() const { (selected_connection_ && selected_connection_->nominated()); } -// TODO(bugs.webrtc.org/14367) remove once refactor lands. -void P2PTransportChannel::PruneConnections() { - RTC_DCHECK_RUN_ON(network_thread_); - std::vector connections_to_prune = - ice_adapter_->LegacyPruneConnections(); - PruneConnections(connections_to_prune); -} - bool P2PTransportChannel::PruneConnections( rtc::ArrayView connections) { RTC_DCHECK_RUN_ON(network_thread_); @@ -1995,7 +1853,7 @@ void P2PTransportChannel::SwitchSelectedConnectionInternal( ++selected_candidate_pair_changes_; - ice_adapter_->OnConnectionSwitched(selected_connection_); + ice_controller_->OnConnectionSwitched(selected_connection_); } int64_t P2PTransportChannel::ComputeEstimatedDisconnectedTimeMs( @@ -2110,7 +1968,7 @@ void P2PTransportChannel::OnSelectedConnectionDestroyed() { RTC_LOG(LS_INFO) << "Selected connection destroyed. Will choose a new one."; IceSwitchReason reason = IceSwitchReason::SELECTED_CONNECTION_DESTROYED; SwitchSelectedConnectionInternal(nullptr, reason); - ice_adapter_->OnSortAndSwitchRequest(reason); + ice_controller_->OnSortAndSwitchRequest(reason); } // If all connections timed out, delete them all. @@ -2143,29 +2001,10 @@ bool P2PTransportChannel::ReadyToSend(const Connection* connection) const { PresumedWritable(connection)); } -// Handle queued up check-and-ping request -// TODO(bugs.webrtc.org/14367) remove once refactor lands. -void P2PTransportChannel::CheckAndPing() { - RTC_DCHECK_RUN_ON(network_thread_); - // Make sure the states of the connections are up-to-date (since this - // affects which ones are pingable). - UpdateConnectionStates(); - - auto result = ice_adapter_->LegacySelectConnectionToPing(last_ping_sent_ms_); - TimeDelta delay = TimeDelta::Millis(result.recheck_delay_ms); - - if (result.connection.value_or(nullptr)) { - SendPingRequest(result.connection.value()); - } - - network_thread_->PostDelayedTask( - SafeTask(task_safety_.flag(), [this]() { CheckAndPing(); }), delay); -} - // This method is only for unit testing. Connection* P2PTransportChannel::FindNextPingableConnection() { RTC_DCHECK_RUN_ON(network_thread_); - const Connection* conn = ice_adapter_->FindNextPingableConnection(); + const Connection* conn = ice_controller_->FindNextPingableConnection(); if (conn) { return FromIceController(conn); } else { @@ -2194,7 +2033,7 @@ void P2PTransportChannel::SendPingRequestInternal(Connection* connection) { // active. void P2PTransportChannel::MarkConnectionPinged(Connection* conn) { RTC_DCHECK_RUN_ON(network_thread_); - ice_adapter_->OnConnectionPinged(conn); + ice_controller_->OnConnectionPinged(conn); } // Apart from sending ping from `conn` this method also updates @@ -2228,7 +2067,7 @@ uint32_t P2PTransportChannel::GetNominationAttr(Connection* conn) const { // Nominate a connection based on the NominationMode. bool P2PTransportChannel::GetUseCandidateAttr(Connection* conn) const { RTC_DCHECK_RUN_ON(network_thread_); - return ice_adapter_->GetUseCandidateAttribute( + return ice_controller_->GetUseCandidateAttribute( conn, config_.default_nomination_mode, remote_ice_mode_); } @@ -2253,7 +2092,7 @@ void P2PTransportChannel::OnConnectionStateChange(Connection* connection) { } // We have to unroll the stack before doing this because we may be changing // the state of connections while sorting. - ice_adapter_->OnSortAndSwitchRequest( + ice_controller_->OnSortAndSwitchRequest( IceSwitchReason::CONNECT_STATE_CHANGE); // "candidate pair state // changed"); } @@ -2293,7 +2132,7 @@ void P2PTransportChannel::RemoveConnection(const Connection* connection) { auto it = absl::c_find(connections_, connection); RTC_DCHECK(it != connections_.end()); connections_.erase(it); - ice_adapter_->OnConnectionDestroyed(connection); + ice_controller_->OnConnectionDestroyed(connection); } // When a port is destroyed, remove it from our list of ports to use for @@ -2394,8 +2233,8 @@ void P2PTransportChannel::OnReadPacket(Connection* connection, // May need to switch the sending connection based on the receiving media // path if this is the controlled side. if (ice_role_ == ICEROLE_CONTROLLED) { - ice_adapter_->OnImmediateSwitchRequest(IceSwitchReason::DATA_RECEIVED, - connection); + ice_controller_->OnImmediateSwitchRequest(IceSwitchReason::DATA_RECEIVED, + connection); } } @@ -2466,172 +2305,4 @@ void P2PTransportChannel::LogCandidatePairConfig( conn->ToLogDescription()); } -P2PTransportChannel::IceControllerAdapter::IceControllerAdapter( - const IceControllerFactoryArgs& args, - IceControllerFactoryInterface* ice_controller_factory, - ActiveIceControllerFactoryInterface* active_ice_controller_factory, - const webrtc::FieldTrialsView* field_trials, - P2PTransportChannel* transport) - : transport_(transport) { - if (UseActiveIceControllerFieldTrialEnabled(field_trials)) { - if (active_ice_controller_factory) { - ActiveIceControllerFactoryArgs active_args{args, - /* ice_agent= */ transport}; - active_ice_controller_ = - active_ice_controller_factory->Create(active_args); - } else { - active_ice_controller_ = std::make_unique( - /* ice_agent= */ transport, ice_controller_factory, args); - } - } else { - if (ice_controller_factory != nullptr) { - legacy_ice_controller_ = ice_controller_factory->Create(args); - } else { - legacy_ice_controller_ = std::make_unique(args); - } - } -} - -P2PTransportChannel::IceControllerAdapter::~IceControllerAdapter() = default; - -void P2PTransportChannel::IceControllerAdapter::SetIceConfig( - const IceConfig& config) { - active_ice_controller_ ? active_ice_controller_->SetIceConfig(config) - : legacy_ice_controller_->SetIceConfig(config); -} - -void P2PTransportChannel::IceControllerAdapter::OnConnectionAdded( - const Connection* connection) { - active_ice_controller_ ? active_ice_controller_->OnConnectionAdded(connection) - : legacy_ice_controller_->AddConnection(connection); -} - -void P2PTransportChannel::IceControllerAdapter::OnConnectionSwitched( - const Connection* connection) { - active_ice_controller_ - ? active_ice_controller_->OnConnectionSwitched(connection) - : legacy_ice_controller_->SetSelectedConnection(connection); -} - -void P2PTransportChannel::IceControllerAdapter::OnConnectionPinged( - const Connection* connection) { - active_ice_controller_ - ? active_ice_controller_->OnConnectionPinged(connection) - : legacy_ice_controller_->MarkConnectionPinged(connection); -} - -void P2PTransportChannel::IceControllerAdapter::OnConnectionDestroyed( - const Connection* connection) { - active_ice_controller_ - ? active_ice_controller_->OnConnectionDestroyed(connection) - : legacy_ice_controller_->OnConnectionDestroyed(connection); -} - -void P2PTransportChannel::IceControllerAdapter::OnConnectionUpdated( - const Connection* connection) { - if (active_ice_controller_) { - active_ice_controller_->OnConnectionUpdated(connection); - return; - } - RTC_DCHECK_NOTREACHED(); -} - -void P2PTransportChannel::IceControllerAdapter::OnSortAndSwitchRequest( - IceSwitchReason reason) { - active_ice_controller_ - ? active_ice_controller_->OnSortAndSwitchRequest(reason) - : transport_->RequestSortAndStateUpdate(reason); -} - -void P2PTransportChannel::IceControllerAdapter::OnImmediateSortAndSwitchRequest( - IceSwitchReason reason) { - active_ice_controller_ - ? active_ice_controller_->OnImmediateSortAndSwitchRequest(reason) - : transport_->SortConnectionsAndUpdateState(reason); -} - -bool P2PTransportChannel::IceControllerAdapter::OnImmediateSwitchRequest( - IceSwitchReason reason, - const Connection* connection) { - return active_ice_controller_ - ? active_ice_controller_->OnImmediateSwitchRequest(reason, - connection) - : transport_->MaybeSwitchSelectedConnection(connection, reason); -} - -bool P2PTransportChannel::IceControllerAdapter::GetUseCandidateAttribute( - const cricket::Connection* connection, - cricket::NominationMode mode, - cricket::IceMode remote_ice_mode) const { - return active_ice_controller_ - ? active_ice_controller_->GetUseCandidateAttribute( - connection, mode, remote_ice_mode) - : legacy_ice_controller_->GetUseCandidateAttr(connection, mode, - remote_ice_mode); -} - -const Connection* -P2PTransportChannel::IceControllerAdapter::FindNextPingableConnection() { - return active_ice_controller_ - ? active_ice_controller_->FindNextPingableConnection() - : legacy_ice_controller_->FindNextPingableConnection(); -} - -rtc::ArrayView -P2PTransportChannel::IceControllerAdapter::LegacyConnections() const { - RTC_DCHECK_RUN_ON(transport_->network_thread_); - if (active_ice_controller_) { - return rtc::ArrayView(transport_->connections_.data(), - transport_->connections_.size()); - } - - rtc::ArrayView res = legacy_ice_controller_->connections(); - return rtc::ArrayView(const_cast(res.data()), - res.size()); -} - -bool P2PTransportChannel::IceControllerAdapter::LegacyHasPingableConnection() - const { - if (active_ice_controller_) { - RTC_DCHECK_NOTREACHED(); - } - return legacy_ice_controller_->HasPingableConnection(); -} - -IceControllerInterface::PingResult -P2PTransportChannel::IceControllerAdapter::LegacySelectConnectionToPing( - int64_t last_ping_sent_ms) { - if (active_ice_controller_) { - RTC_DCHECK_NOTREACHED(); - } - return legacy_ice_controller_->SelectConnectionToPing(last_ping_sent_ms); -} - -IceControllerInterface::SwitchResult -P2PTransportChannel::IceControllerAdapter::LegacyShouldSwitchConnection( - IceSwitchReason reason, - const Connection* connection) { - if (active_ice_controller_) { - RTC_DCHECK_NOTREACHED(); - } - return legacy_ice_controller_->ShouldSwitchConnection(reason, connection); -} - -IceControllerInterface::SwitchResult -P2PTransportChannel::IceControllerAdapter::LegacySortAndSwitchConnection( - IceSwitchReason reason) { - if (active_ice_controller_) { - RTC_DCHECK_NOTREACHED(); - } - return legacy_ice_controller_->SortAndSwitchConnection(reason); -} - -std::vector -P2PTransportChannel::IceControllerAdapter::LegacyPruneConnections() { - if (active_ice_controller_) { - RTC_DCHECK_NOTREACHED(); - } - return legacy_ice_controller_->PruneConnections(); -} - } // namespace cricket diff --git a/p2p/base/p2p_transport_channel.h b/p2p/base/p2p_transport_channel.h index f7bfce0e17..3b67e7ed3b 100644 --- a/p2p/base/p2p_transport_channel.h +++ b/p2p/base/p2p_transport_channel.h @@ -278,16 +278,8 @@ class RTC_EXPORT P2PTransportChannel : public IceTransportInternal, // Returns true if it's possible to send packets on `connection`. bool ReadyToSend(const Connection* connection) const; bool PresumedWritable(const Connection* conn) const; - // TODO(bugs.webrtc.org/14367) remove once refactor lands. - void RequestSortAndStateUpdate(IceSwitchReason reason_to_sort); - // Start pinging if we haven't already started, and we now have a connection - // that's pingable. - // TODO(bugs.webrtc.org/14367) remove once refactor lands. - void MaybeStartPinging(); void SendPingRequestInternal(Connection* connection); - // TODO(bugs.webrtc.org/14367) remove once refactor lands. - void SortConnectionsAndUpdateState(IceSwitchReason reason_to_sort); rtc::NetworkRoute ConfigureNetworkRoute(const Connection* conn); void SwitchSelectedConnectionInternal(Connection* conn, IceSwitchReason reason); @@ -355,26 +347,13 @@ class RTC_EXPORT P2PTransportChannel : public IceTransportInternal, void OnNominated(Connection* conn); - // TODO(bugs.webrtc.org/14367) remove once refactor lands. - void CheckAndPing(); - void LogCandidatePairConfig(Connection* conn, webrtc::IceCandidatePairConfigType type); uint32_t GetNominationAttr(Connection* conn) const; bool GetUseCandidateAttr(Connection* conn) const; - // Returns true if the new_connection is selected for transmission. - // TODO(bugs.webrtc.org/14367) remove once refactor lands. - bool MaybeSwitchSelectedConnection(const Connection* new_connection, - IceSwitchReason reason); - // TODO(bugs.webrtc.org/14367) remove once refactor lands. - bool MaybeSwitchSelectedConnection( - IceSwitchReason reason, - IceControllerInterface::SwitchResult result); bool AllowedToPruneConnections() const; - // TODO(bugs.webrtc.org/14367) remove once refactor lands. - void PruneConnections(); // Returns the latest remote ICE parameters or nullptr if there are no remote // ICE parameters yet. @@ -431,8 +410,6 @@ class RTC_EXPORT P2PTransportChannel : public IceTransportInternal, void ParseFieldTrials(const webrtc::FieldTrialsView* field_trials); - // TODO(bugs.webrtc.org/14367) remove once refactor lands. - webrtc::ScopedTaskSafety task_safety_; std::string transport_name_ RTC_GUARDED_BY(network_thread_); int component_ RTC_GUARDED_BY(network_thread_); PortAllocator* allocator_ RTC_GUARDED_BY(network_thread_); @@ -459,9 +436,6 @@ class RTC_EXPORT P2PTransportChannel : public IceTransportInternal, std::vector remote_candidates_ RTC_GUARDED_BY(network_thread_); - // TODO(bugs.webrtc.org/14367) remove once refactor lands. - bool sort_dirty_ RTC_GUARDED_BY( - network_thread_); // indicates whether another sort is needed right now bool had_connection_ RTC_GUARDED_BY(network_thread_) = false; // if connections_ has ever been nonempty typedef std::map OptionMap; @@ -486,8 +460,6 @@ class RTC_EXPORT P2PTransportChannel : public IceTransportInternal, IceConfig config_ RTC_GUARDED_BY(network_thread_); int last_sent_packet_id_ RTC_GUARDED_BY(network_thread_) = -1; // -1 indicates no packet was sent before. - // TODO(bugs.webrtc.org/14367) remove once refactor lands. - bool started_pinging_ RTC_GUARDED_BY(network_thread_) = false; // The value put in the "nomination" attribute for the next nominated // connection. A zero-value indicates the connection will not be nominated. uint32_t nomination_ RTC_GUARDED_BY(network_thread_) = 0; @@ -500,53 +472,7 @@ class RTC_EXPORT P2PTransportChannel : public IceTransportInternal, RTC_GUARDED_BY(network_thread_); webrtc::IceEventLog ice_event_log_ RTC_GUARDED_BY(network_thread_); - // The adapter transparently delegates ICE controller interactions to either - // the legacy or the active ICE controller depending on field trials. - // TODO(bugs.webrtc.org/14367) replace with active ICE controller eventually. - class IceControllerAdapter : public ActiveIceControllerInterface { - public: - IceControllerAdapter( - const IceControllerFactoryArgs& args, - IceControllerFactoryInterface* ice_controller_factory, - ActiveIceControllerFactoryInterface* active_ice_controller_factory, - const webrtc::FieldTrialsView* field_trials, - P2PTransportChannel* transport); - ~IceControllerAdapter() override; - - // ActiveIceControllerInterface overrides - void SetIceConfig(const IceConfig& config) override; - void OnConnectionAdded(const Connection* connection) override; - void OnConnectionSwitched(const Connection* connection) override; - void OnConnectionPinged(const Connection* connection) override; - void OnConnectionDestroyed(const Connection* connection) override; - void OnConnectionUpdated(const Connection* connection) override; - void OnSortAndSwitchRequest(IceSwitchReason reason) override; - void OnImmediateSortAndSwitchRequest(IceSwitchReason reason) override; - bool OnImmediateSwitchRequest(IceSwitchReason reason, - const Connection* connection) override; - bool GetUseCandidateAttribute(const Connection* connection, - NominationMode mode, - IceMode remote_ice_mode) const override; - const Connection* FindNextPingableConnection() override; - - // Methods only available with legacy ICE controller. - rtc::ArrayView LegacyConnections() const; - bool LegacyHasPingableConnection() const; - IceControllerInterface::PingResult LegacySelectConnectionToPing( - int64_t last_ping_sent_ms); - IceControllerInterface::SwitchResult LegacyShouldSwitchConnection( - IceSwitchReason reason, - const Connection* connection); - IceControllerInterface::SwitchResult LegacySortAndSwitchConnection( - IceSwitchReason reason); - std::vector LegacyPruneConnections(); - - private: - P2PTransportChannel* transport_; - std::unique_ptr legacy_ice_controller_; - std::unique_ptr active_ice_controller_; - }; - std::unique_ptr ice_adapter_ + std::unique_ptr ice_controller_ RTC_GUARDED_BY(network_thread_); struct CandidateAndResolver final {