#include "third_party/webrtc_overrides/p2p/base/bridge_ice_controller.h"
#include <algorithm>
#include <iterator>
#include <memory>
#include <optional>
#include <vector>
#include "base/check.h"
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/scoped_refptr.h"
#include "base/time/time.h"
#include "third_party/webrtc/api/array_view.h"
#include "third_party/webrtc/api/rtc_error.h"
#include "third_party/webrtc/p2p/base/connection.h"
#include "third_party/webrtc/p2p/base/ice_agent_interface.h"
#include "third_party/webrtc/p2p/base/ice_controller_interface.h"
#include "third_party/webrtc/p2p/base/ice_switch_reason.h"
#include "third_party/webrtc/p2p/base/ice_transport_internal.h"
#include "third_party/webrtc/p2p/base/transport_description.h"
#include "third_party/webrtc_overrides/p2p/base/ice_connection.h"
#include "third_party/webrtc_overrides/p2p/base/ice_controller_observer.h"
#include "third_party/webrtc_overrides/p2p/base/ice_ping_proposal.h"
#include "third_party/webrtc_overrides/p2p/base/ice_prune_proposal.h"
#include "third_party/webrtc_overrides/p2p/base/ice_switch_proposal.h"
#include "third_party/webrtc_overrides/rtc_base/diagnostic_logging.h"
#include "third_party/webrtc_overrides/rtc_base/logging.h"
namespace {
Connection;
IceAgentInterface;
IceConfig;
IceControllerInterface;
IceMode;
IceRole;
NominationMode;
}
namespace blink {
BridgeIceController::BridgeIceController(
scoped_refptr<base::SequencedTaskRunner> network_task_runner,
IceControllerObserverInterface* observer,
IceAgentInterface* ice_agent,
std::unique_ptr<cricket::IceControllerInterface> native_controller)
: … { … }
BridgeIceController::BridgeIceController(
scoped_refptr<base::SequencedTaskRunner> task_runner,
IceAgentInterface* ice_agent,
std::unique_ptr<IceControllerInterface> native_controller)
: … { … }
BridgeIceController::~BridgeIceController() = default;
void BridgeIceController::AttachObserver(
IceControllerObserverInterface* observer) { … }
void BridgeIceController::SetIceConfig(const IceConfig& config) { … }
bool BridgeIceController::GetUseCandidateAttribute(
const Connection* connection,
NominationMode mode,
IceMode remote_ice_mode) const { … }
void BridgeIceController::OnConnectionAdded(const Connection* connection) { … }
void BridgeIceController::OnConnectionPinged(const Connection* connection) { … }
void BridgeIceController::OnConnectionUpdated(const Connection* connection) { … }
void BridgeIceController::OnConnectionSwitched(const Connection* connection) { … }
void BridgeIceController::OnConnectionDestroyed(const Connection* connection) { … }
void BridgeIceController::MaybeStartPinging() { … }
void BridgeIceController::SelectAndPingConnection() { … }
void BridgeIceController::OnPingProposalAccepted(
const IcePingProposal& proposal) { … }
void BridgeIceController::OnPingProposalRejected(
const IcePingProposal& proposal) { … }
void BridgeIceController::DoPerformPing(
const cricket::IceControllerInterface::PingResult result) { … }
void BridgeIceController::DoPerformPing(const cricket::Connection* connection,
std::optional<int> recheck_delay_ms) { … }
void BridgeIceController::DoSchedulePingRecheck(
std::optional<int> recheck_delay_ms) { … }
void BridgeIceController::OnSortAndSwitchRequest(
cricket::IceSwitchReason reason) { … }
void BridgeIceController::SortAndSwitchToBestConnection(
cricket::IceSwitchReason reason) { … }
void BridgeIceController::OnImmediateSortAndSwitchRequest(
cricket::IceSwitchReason reason) { … }
void BridgeIceController::DoSortAndSwitchToBestConnection(
cricket::IceSwitchReason reason) { … }
bool BridgeIceController::OnImmediateSwitchRequest(
cricket::IceSwitchReason reason,
const Connection* selected) { … }
void BridgeIceController::OnSwitchProposalAccepted(
const IceSwitchProposal& proposal) { … }
void BridgeIceController::OnSwitchProposalRejected(
const IceSwitchProposal& proposal) { … }
void BridgeIceController::DoPerformSwitch(
cricket::IceSwitchReason reason_for_switch,
const IceControllerInterface::SwitchResult result) { … }
void BridgeIceController::DoPerformSwitch(
cricket::IceSwitchReason reason_for_switch,
const cricket::Connection* connection,
std::optional<cricket::IceRecheckEvent> recheck_event,
base::span<const cricket::Connection* const>
connections_to_forget_state_on) { … }
void BridgeIceController::DoScheduleSwitchRecheck(
std::optional<cricket::IceRecheckEvent> recheck_event) { … }
void BridgeIceController::UpdateStateOnConnectionsResorted() { … }
void BridgeIceController::PruneConnections() { … }
void BridgeIceController::UpdateStateOnPrune() { … }
void BridgeIceController::OnPruneProposalAccepted(
const IcePruneProposal& proposal) { … }
void BridgeIceController::OnPruneProposalRejected(
const IcePruneProposal& proposal) { … }
void BridgeIceController::DoPerformPrune(
base::span<const cricket::Connection* const> connections) { … }
const Connection* BridgeIceController::FindNextPingableConnection() { … }
webrtc::RTCError BridgeIceController::OnPingRequested(
const IceConnection& ice_connection) { … }
webrtc::RTCError BridgeIceController::OnSwitchRequested(
const IceConnection& ice_connection) { … }
webrtc::RTCError BridgeIceController::OnPruneRequested(
base::span<const IceConnection> ice_connections_to_prune) { … }
const cricket::Connection* BridgeIceController::FindConnection(
uint32_t id) const { … }
BridgeIceController::IceInteractionProxy::IceInteractionProxy(
BridgeIceController* controller,
scoped_refptr<base::SequencedTaskRunner> task_runner)
: … { … }
void BridgeIceController::IceInteractionProxy::AcceptPingProposal(
const IcePingProposal& proposal) { … }
void BridgeIceController::IceInteractionProxy::RejectPingProposal(
const IcePingProposal& proposal) { … }
void BridgeIceController::IceInteractionProxy::AcceptSwitchProposal(
const IceSwitchProposal& proposal) { … }
void BridgeIceController::IceInteractionProxy::RejectSwitchProposal(
const IceSwitchProposal& proposal) { … }
void BridgeIceController::IceInteractionProxy::AcceptPruneProposal(
const IcePruneProposal& proposal) { … }
void BridgeIceController::IceInteractionProxy::RejectPruneProposal(
const IcePruneProposal& proposal) { … }
webrtc::RTCError BridgeIceController::IceInteractionProxy::PingIceConnection(
const IceConnection& connection) { … }
webrtc::RTCError
BridgeIceController::IceInteractionProxy::SwitchToIceConnection(
const IceConnection& connection) { … }
webrtc::RTCError BridgeIceController::IceInteractionProxy::PruneIceConnections(
base::span<const IceConnection> connections_to_prune) { … }
}