Add IceConfig getter to IceTransportInternal(Interface)
and misc cleanup BUG=webrtc:367395350 No-Iwyu: remaining IWYU failure is deep inside gtest which is unrelated to the changes and needs to be investigated separately Change-Id: I5c2b7a6cc6b15fc5474c55eb98635cb9145b7373 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/370180 Reviewed-by: Jonas Oreland <jonaso@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Philipp Hancke <phancke@meta.com> Cr-Commit-Position: refs/heads/main@{#43498}
This commit is contained in:
parent
0c282c471b
commit
1cf342a321
@ -511,19 +511,25 @@ rtc_library("ice_transport_internal") {
|
||||
"base/ice_transport_internal.h",
|
||||
]
|
||||
deps = [
|
||||
":candidate_pair_interface",
|
||||
":connection",
|
||||
":connection_info",
|
||||
":p2p_constants",
|
||||
":packet_transport_internal",
|
||||
":port",
|
||||
":stun_dictionary",
|
||||
":transport_description",
|
||||
"../api:array_view",
|
||||
"../api:candidate",
|
||||
"../api:rtc_error",
|
||||
"../api/transport:enums",
|
||||
"../rtc_base:callback_list",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:network_constants",
|
||||
"../rtc_base:timeutils",
|
||||
"../rtc_base/system:rtc_export",
|
||||
"../rtc_base/third_party/sigslot",
|
||||
"//third_party/abseil-cpp/absl/functional:any_invocable",
|
||||
"//third_party/abseil-cpp/absl/strings:string_view",
|
||||
]
|
||||
}
|
||||
@ -543,6 +549,7 @@ rtc_library("p2p_transport_channel") {
|
||||
]
|
||||
deps = [
|
||||
":active_ice_controller_factory_interface",
|
||||
":active_ice_controller_interface",
|
||||
":basic_ice_controller",
|
||||
":candidate_pair_interface",
|
||||
":connection",
|
||||
@ -581,6 +588,7 @@ rtc_library("p2p_transport_channel") {
|
||||
"../rtc_base:logging",
|
||||
"../rtc_base:macromagic",
|
||||
"../rtc_base:net_helper",
|
||||
"../rtc_base:net_helpers",
|
||||
"../rtc_base:network",
|
||||
"../rtc_base:network_constants",
|
||||
"../rtc_base:network_route",
|
||||
@ -590,6 +598,7 @@ rtc_library("p2p_transport_channel") {
|
||||
"../rtc_base:threading",
|
||||
"../rtc_base:timeutils",
|
||||
"../rtc_base/experiments:field_trial_parser",
|
||||
"../rtc_base/network:received_packet",
|
||||
"../rtc_base/network:sent_packet",
|
||||
"../rtc_base/system:rtc_export",
|
||||
"../system_wrappers:metrics",
|
||||
|
||||
@ -257,6 +257,8 @@ class FakeIceTransport : public IceTransportInternal {
|
||||
ice_config_ = config;
|
||||
}
|
||||
|
||||
const IceConfig& config() const override { return ice_config_; }
|
||||
|
||||
void AddRemoteCandidate(const Candidate& candidate) override {
|
||||
RTC_DCHECK_RUN_ON(network_thread_);
|
||||
remote_candidates_.push_back(candidate);
|
||||
|
||||
@ -13,24 +13,30 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/functional/any_invocable.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/array_view.h"
|
||||
#include "api/candidate.h"
|
||||
#include "api/rtc_error.h"
|
||||
#include "api/transport/enums.h"
|
||||
#include "p2p/base/candidate_pair_interface.h"
|
||||
#include "p2p/base/connection.h"
|
||||
#include "p2p/base/connection_info.h"
|
||||
#include "p2p/base/packet_transport_internal.h"
|
||||
#include "p2p/base/port.h"
|
||||
#include "p2p/base/stun_dictionary.h"
|
||||
#include "p2p/base/transport_description.h"
|
||||
#include "rtc_base/callback_list.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/network_constants.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
#include "rtc_base/third_party/sigslot/sigslot.h"
|
||||
#include "rtc_base/time_utils.h"
|
||||
|
||||
namespace cricket {
|
||||
|
||||
@ -276,6 +282,7 @@ class RTC_EXPORT IceTransportInternal : public rtc::PacketTransportInternal {
|
||||
virtual void SetRemoteIceMode(IceMode mode) = 0;
|
||||
|
||||
virtual void SetIceConfig(const IceConfig& config) = 0;
|
||||
virtual const IceConfig& config() const = 0;
|
||||
|
||||
// Start gathering candidates if not already started, or if an ICE restart
|
||||
// occurred.
|
||||
|
||||
@ -16,12 +16,8 @@
|
||||
#include <vector>
|
||||
|
||||
#include "p2p/base/ice_transport_internal.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
#include "test/gmock.h"
|
||||
|
||||
using ::testing::_;
|
||||
using ::testing::Return;
|
||||
|
||||
namespace cricket {
|
||||
|
||||
// Used in Chromium/remoting/protocol/channel_socket_adapter_unittest.cc
|
||||
@ -62,7 +58,8 @@ class MockIceTransport : public IceTransportInternal {
|
||||
void SetIceParameters(const IceParameters& /* ice_params */) override {}
|
||||
void SetRemoteIceParameters(const IceParameters& /* ice_params */) override {}
|
||||
void SetRemoteIceMode(IceMode /* mode */) override {}
|
||||
void SetIceConfig(const IceConfig& /* config */) override {}
|
||||
void SetIceConfig(const IceConfig& config) override { ice_config_ = config; }
|
||||
const IceConfig& config() const override { return ice_config_; }
|
||||
std::optional<int> GetRttEstimate() override { return std::nullopt; }
|
||||
const Connection* selected_connection() const override { return nullptr; }
|
||||
std::optional<const CandidatePair> GetSelectedCandidatePair() const override {
|
||||
@ -81,6 +78,7 @@ class MockIceTransport : public IceTransportInternal {
|
||||
|
||||
private:
|
||||
std::string transport_name_;
|
||||
IceConfig ice_config_;
|
||||
};
|
||||
|
||||
} // namespace cricket
|
||||
|
||||
@ -14,36 +14,64 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/algorithm/container.h"
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/match.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/array_view.h"
|
||||
#include "api/async_dns_resolver.h"
|
||||
#include "api/candidate.h"
|
||||
#include "api/field_trials_view.h"
|
||||
#include "api/ice_transport_interface.h"
|
||||
#include "api/rtc_error.h"
|
||||
#include "api/sequence_checker.h"
|
||||
#include "api/transport/enums.h"
|
||||
#include "api/transport/stun.h"
|
||||
#include "api/units/time_delta.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h"
|
||||
#include "logging/rtc_event_log/ice_logger.h"
|
||||
#include "p2p/base/basic_ice_controller.h"
|
||||
#include "p2p/base/active_ice_controller_factory_interface.h"
|
||||
#include "p2p/base/candidate_pair_interface.h"
|
||||
#include "p2p/base/connection.h"
|
||||
#include "p2p/base/connection_info.h"
|
||||
#include "p2p/base/ice_controller_factory_interface.h"
|
||||
#include "p2p/base/ice_switch_reason.h"
|
||||
#include "p2p/base/ice_transport_internal.h"
|
||||
#include "p2p/base/p2p_constants.h"
|
||||
#include "p2p/base/port.h"
|
||||
#include "p2p/base/port_allocator.h"
|
||||
#include "p2p/base/port_interface.h"
|
||||
#include "p2p/base/regathering_controller.h"
|
||||
#include "p2p/base/transport_description.h"
|
||||
#include "p2p/base/wrapping_active_ice_controller.h"
|
||||
#include "rtc_base/async_packet_socket.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/dscp.h"
|
||||
#include "rtc_base/experiments/struct_parameters_parser.h"
|
||||
#include "rtc_base/ip_address.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/net_helper.h"
|
||||
#include "rtc_base/net_helpers.h"
|
||||
#include "rtc_base/network.h"
|
||||
#include "rtc_base/network/received_packet.h"
|
||||
#include "rtc_base/network/sent_packet.h"
|
||||
#include "rtc_base/network_constants.h"
|
||||
#include "rtc_base/string_encode.h"
|
||||
#include "rtc_base/network_route.h"
|
||||
#include "rtc_base/socket.h"
|
||||
#include "rtc_base/socket_address.h"
|
||||
#include "rtc_base/time_utils.h"
|
||||
#include "rtc_base/trace_event.h"
|
||||
#include "system_wrappers/include/metrics.h"
|
||||
|
||||
namespace cricket {
|
||||
namespace {
|
||||
@ -987,6 +1015,7 @@ void P2PTransportChannel::OnUnknownAddress(PortInterface* port,
|
||||
const std::string& remote_username,
|
||||
bool port_muxed) {
|
||||
RTC_DCHECK_RUN_ON(network_thread_);
|
||||
RTC_DCHECK(stun_msg);
|
||||
|
||||
// Port has received a valid stun packet from an address that no Connection
|
||||
// is currently available for. See if we already have a candidate with the
|
||||
|
||||
@ -23,16 +23,13 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/base/attributes.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/array_view.h"
|
||||
#include "api/async_dns_resolver.h"
|
||||
@ -40,12 +37,12 @@
|
||||
#include "api/ice_transport_interface.h"
|
||||
#include "api/rtc_error.h"
|
||||
#include "api/sequence_checker.h"
|
||||
#include "api/task_queue/pending_task_safety_flag.h"
|
||||
#include "api/transport/enums.h"
|
||||
#include "api/transport/stun.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h"
|
||||
#include "logging/rtc_event_log/ice_logger.h"
|
||||
#include "p2p/base/active_ice_controller_factory_interface.h"
|
||||
#include "p2p/base/active_ice_controller_interface.h"
|
||||
#include "p2p/base/candidate_pair_interface.h"
|
||||
#include "p2p/base/connection.h"
|
||||
#include "p2p/base/ice_agent_interface.h"
|
||||
@ -64,6 +61,7 @@
|
||||
#include "rtc_base/async_packet_socket.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/dscp.h"
|
||||
#include "rtc_base/network/received_packet.h"
|
||||
#include "rtc_base/network/sent_packet.h"
|
||||
#include "rtc_base/network_route.h"
|
||||
#include "rtc_base/socket.h"
|
||||
@ -146,7 +144,7 @@ class RTC_EXPORT P2PTransportChannel : public IceTransportInternal,
|
||||
// will not use it to update the respective parameter in `config_`.
|
||||
// TODO(deadbeef): Use std::optional instead of negative values.
|
||||
void SetIceConfig(const IceConfig& config) override;
|
||||
const IceConfig& config() const;
|
||||
const IceConfig& config() const override;
|
||||
static webrtc::RTCError ValidateIceConfig(const IceConfig& config);
|
||||
|
||||
// From TransportChannel:
|
||||
|
||||
@ -584,8 +584,7 @@ RTCErrorOr<rtc::scoped_refptr<PeerConnection>> PeerConnection::Create(
|
||||
<< "PeerConnection constructed with legacy SDP semantics!";
|
||||
}
|
||||
|
||||
RTCError config_error = cricket::P2PTransportChannel::ValidateIceConfig(
|
||||
ParseIceConfig(configuration));
|
||||
RTCError config_error = ValidateConfiguration(configuration);
|
||||
if (!config_error.ok()) {
|
||||
RTC_LOG(LS_ERROR) << "Invalid ICE configuration: "
|
||||
<< config_error.message();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user