mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 22:00:47 +01:00
[PCLF] Add ability to specify custom PortAllocator flags
Bug: b/196034093 Change-Id: Ia1838c5c9ace096d7e77e31f7f2ad6b6352fd1ea Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/252100 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Jonas Oreland <jonaso@google.com> Reviewed-by: Jonas Oreland <jonaso@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36060}
This commit is contained in:
parent
286664c381
commit
003e6e99b3
6 changed files with 23 additions and 3 deletions
|
@ -371,6 +371,11 @@ class PeerConnectionE2EQualityTestFixture {
|
||||||
std::unique_ptr<rtc::SSLCertificateVerifier> tls_cert_verifier) = 0;
|
std::unique_ptr<rtc::SSLCertificateVerifier> tls_cert_verifier) = 0;
|
||||||
virtual PeerConfigurer* SetIceTransportFactory(
|
virtual PeerConfigurer* SetIceTransportFactory(
|
||||||
std::unique_ptr<IceTransportFactory> factory) = 0;
|
std::unique_ptr<IceTransportFactory> factory) = 0;
|
||||||
|
// Flags to set on `cricket::PortAllocator`. These flags will be added
|
||||||
|
// to the default ones that are presented on the port allocator.
|
||||||
|
// For possible values check p2p/base/port_allocator.h.
|
||||||
|
virtual PeerConfigurer* SetPortAllocatorExtraFlags(
|
||||||
|
uint32_t extra_flags) = 0;
|
||||||
|
|
||||||
// Add new video stream to the call that will be sent from this peer.
|
// Add new video stream to the call that will be sent from this peer.
|
||||||
// Default implementation of video frames generator will be used.
|
// Default implementation of video frames generator will be used.
|
||||||
|
|
|
@ -60,6 +60,9 @@ specific_include_rules = {
|
||||||
"+pc",
|
"+pc",
|
||||||
"+p2p",
|
"+p2p",
|
||||||
],
|
],
|
||||||
|
".*peer_connection_quality_test_params\.h": [
|
||||||
|
"+p2p/base/port_allocator.h",
|
||||||
|
],
|
||||||
".*network_emulation_pc_unittest\.cc": [
|
".*network_emulation_pc_unittest\.cc": [
|
||||||
"+pc/peer_connection_wrapper.h",
|
"+pc/peer_connection_wrapper.h",
|
||||||
"+pc/test/mock_peer_connection_observers.h",
|
"+pc/test/mock_peer_connection_observers.h",
|
||||||
|
|
|
@ -60,6 +60,7 @@ if (!build_with_chromium) {
|
||||||
"../../../api/transport:network_control",
|
"../../../api/transport:network_control",
|
||||||
"../../../api/transport:webrtc_key_value_config",
|
"../../../api/transport:webrtc_key_value_config",
|
||||||
"../../../api/video_codecs:video_codecs_api",
|
"../../../api/video_codecs:video_codecs_api",
|
||||||
|
"../../../p2p:rtc_p2p",
|
||||||
"../../../rtc_base",
|
"../../../rtc_base",
|
||||||
"../../../rtc_base:threading",
|
"../../../rtc_base:threading",
|
||||||
]
|
]
|
||||||
|
|
|
@ -195,6 +195,11 @@ class PeerConfigurerImpl final
|
||||||
components_->pc_dependencies->ice_transport_factory = std::move(factory);
|
components_->pc_dependencies->ice_transport_factory = std::move(factory);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PeerConfigurer* SetPortAllocatorExtraFlags(uint32_t extra_flags) override {
|
||||||
|
params_->port_allocator_extra_flags = extra_flags;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
// Implementation of PeerConnectionE2EQualityTestFixture::PeerConfigurer end.
|
// Implementation of PeerConnectionE2EQualityTestFixture::PeerConfigurer end.
|
||||||
|
|
||||||
InjectableComponents* components() { return components_.get(); }
|
InjectableComponents* components() { return components_.get(); }
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "api/transport/webrtc_key_value_config.h"
|
#include "api/transport/webrtc_key_value_config.h"
|
||||||
#include "api/video_codecs/video_decoder_factory.h"
|
#include "api/video_codecs/video_decoder_factory.h"
|
||||||
#include "api/video_codecs/video_encoder_factory.h"
|
#include "api/video_codecs/video_encoder_factory.h"
|
||||||
|
#include "p2p/base/port_allocator.h"
|
||||||
#include "rtc_base/network.h"
|
#include "rtc_base/network.h"
|
||||||
#include "rtc_base/rtc_certificate_generator.h"
|
#include "rtc_base/rtc_certificate_generator.h"
|
||||||
#include "rtc_base/ssl_certificate.h"
|
#include "rtc_base/ssl_certificate.h"
|
||||||
|
@ -112,6 +113,9 @@ struct Params {
|
||||||
std::vector<PeerConnectionE2EQualityTestFixture::VideoConfig> video_configs;
|
std::vector<PeerConnectionE2EQualityTestFixture::VideoConfig> video_configs;
|
||||||
// If `audio_config` is set audio stream will be configured
|
// If `audio_config` is set audio stream will be configured
|
||||||
absl::optional<PeerConnectionE2EQualityTestFixture::AudioConfig> audio_config;
|
absl::optional<PeerConnectionE2EQualityTestFixture::AudioConfig> audio_config;
|
||||||
|
// Flags to set on `cricket::PortAllocator`. These flags will be added
|
||||||
|
// to the default ones that are presented on the port allocator.
|
||||||
|
uint32_t port_allocator_extra_flags = cricket::kDefaultPortAllocatorFlags;
|
||||||
// If `rtc_event_log_path` is set, an RTCEventLog will be saved in that
|
// If `rtc_event_log_path` is set, an RTCEventLog will be saved in that
|
||||||
// location and it will be available for further analysis.
|
// location and it will be available for further analysis.
|
||||||
absl::optional<std::string> rtc_event_log_path;
|
absl::optional<std::string> rtc_event_log_path;
|
||||||
|
|
|
@ -257,6 +257,7 @@ PeerConnectionFactoryDependencies CreatePCFDependencies(
|
||||||
// from InjectableComponents::PeerConnectionComponents.
|
// from InjectableComponents::PeerConnectionComponents.
|
||||||
PeerConnectionDependencies CreatePCDependencies(
|
PeerConnectionDependencies CreatePCDependencies(
|
||||||
MockPeerConnectionObserver* observer,
|
MockPeerConnectionObserver* observer,
|
||||||
|
uint32_t port_allocator_extra_flags,
|
||||||
std::unique_ptr<PeerConnectionComponents> pc_dependencies) {
|
std::unique_ptr<PeerConnectionComponents> pc_dependencies) {
|
||||||
PeerConnectionDependencies pc_deps(observer);
|
PeerConnectionDependencies pc_deps(observer);
|
||||||
|
|
||||||
|
@ -264,7 +265,7 @@ PeerConnectionDependencies CreatePCDependencies(
|
||||||
pc_dependencies->network_manager, pc_dependencies->packet_socket_factory);
|
pc_dependencies->network_manager, pc_dependencies->packet_socket_factory);
|
||||||
|
|
||||||
// This test does not support TCP
|
// This test does not support TCP
|
||||||
int flags = cricket::PORTALLOCATOR_DISABLE_TCP;
|
int flags = port_allocator_extra_flags | cricket::PORTALLOCATOR_DISABLE_TCP;
|
||||||
port_allocator->set_flags(port_allocator->flags() | flags);
|
port_allocator->set_flags(port_allocator->flags() | flags);
|
||||||
|
|
||||||
pc_deps.allocator = std::move(port_allocator);
|
pc_deps.allocator = std::move(port_allocator);
|
||||||
|
@ -344,8 +345,9 @@ std::unique_ptr<TestPeer> TestPeerFactory::CreateTestPeer(
|
||||||
CreateModularPeerConnectionFactory(std::move(pcf_deps));
|
CreateModularPeerConnectionFactory(std::move(pcf_deps));
|
||||||
|
|
||||||
// Create peer connection.
|
// Create peer connection.
|
||||||
PeerConnectionDependencies pc_deps = CreatePCDependencies(
|
PeerConnectionDependencies pc_deps =
|
||||||
observer.get(), std::move(components->pc_dependencies));
|
CreatePCDependencies(observer.get(), params->port_allocator_extra_flags,
|
||||||
|
std::move(components->pc_dependencies));
|
||||||
rtc::scoped_refptr<PeerConnectionInterface> peer_connection =
|
rtc::scoped_refptr<PeerConnectionInterface> peer_connection =
|
||||||
peer_connection_factory
|
peer_connection_factory
|
||||||
->CreatePeerConnectionOrError(params->rtc_configuration,
|
->CreatePeerConnectionOrError(params->rtc_configuration,
|
||||||
|
|
Loading…
Reference in a new issue