blob: 47f463e968e28b27da01b707bb57f4f528433c22 [file] [log] [blame]
Seth Hampsond1003d72018-06-22 22:40:161/*
2 * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Yves Gerey3e707812018-11-28 15:47:4911#include <memory>
12#include <string>
13#include <utility>
14#include <vector>
15
Yves Gerey3e707812018-11-28 15:47:4916#include "absl/types/optional.h"
17#include "api/audio/audio_mixer.h"
Seth Hampsond1003d72018-06-22 22:40:1618#include "api/audio_codecs/builtin_audio_decoder_factory.h"
19#include "api/audio_codecs/builtin_audio_encoder_factory.h"
Yves Gerey3e707812018-11-28 15:47:4920#include "api/audio_options.h"
Mirko Bonadei2ff3f492018-11-22 08:00:1321#include "api/create_peerconnection_factory.h"
Yves Gerey3e707812018-11-28 15:47:4922#include "api/jsep.h"
Steve Anton10542f22019-01-11 17:11:0023#include "api/media_stream_interface.h"
24#include "api/peer_connection_interface.h"
Harald Alvestrandc24a2182022-02-23 13:44:5925#include "api/rtc_error.h"
Mirko Bonadeid9708072019-01-25 19:26:4826#include "api/scoped_refptr.h"
Steve Anton10542f22019-01-11 17:11:0027#include "api/stats/rtc_stats.h"
28#include "api/stats/rtc_stats_report.h"
Seth Hampsond1003d72018-06-22 22:40:1629#include "api/stats/rtcstats_objects.h"
Artem Titov2ae3f7b2022-09-24 23:13:1030#include "api/test/metrics/global_metrics_logger_and_exporter.h"
31#include "api/test/metrics/metric.h"
Seth Hampsond1003d72018-06-22 22:40:1632#include "api/video_codecs/builtin_video_decoder_factory.h"
33#include "api/video_codecs/builtin_video_encoder_factory.h"
Yves Gerey3e707812018-11-28 15:47:4934#include "modules/audio_device/include/audio_device.h"
35#include "modules/audio_processing/include/audio_processing.h"
Steve Anton10542f22019-01-11 17:11:0036#include "p2p/base/port_allocator.h"
37#include "p2p/base/port_interface.h"
38#include "p2p/base/test_turn_server.h"
39#include "p2p/client/basic_port_allocator.h"
40#include "pc/peer_connection.h"
41#include "pc/peer_connection_wrapper.h"
42#include "pc/test/fake_audio_capture_module.h"
43#include "pc/test/frame_generator_capturer_video_track_source.h"
44#include "pc/test/mock_peer_connection_observers.h"
Yves Gerey3e707812018-11-28 15:47:4945#include "rtc_base/checks.h"
Steve Anton10542f22019-01-11 17:11:0046#include "rtc_base/fake_network.h"
47#include "rtc_base/firewall_socket_server.h"
Seth Hampsond1003d72018-06-22 22:40:1648#include "rtc_base/gunit.h"
Yves Gerey3e707812018-11-28 15:47:4949#include "rtc_base/helpers.h"
Steve Anton10542f22019-01-11 17:11:0050#include "rtc_base/socket_address.h"
Harald Alvestrandc24a2182022-02-23 13:44:5951#include "rtc_base/socket_factory.h"
Steve Anton10542f22019-01-11 17:11:0052#include "rtc_base/ssl_certificate.h"
Danil Chapovalov2aaef452022-08-12 13:55:1153#include "rtc_base/task_queue_for_test.h"
Steve Anton10542f22019-01-11 17:11:0054#include "rtc_base/test_certificate_verifier.h"
Yves Gerey3e707812018-11-28 15:47:4955#include "rtc_base/thread.h"
Steve Anton10542f22019-01-11 17:11:0056#include "rtc_base/virtual_socket_server.h"
Yves Gerey3e707812018-11-28 15:47:4957#include "system_wrappers/include/clock.h"
Seth Hampsond1003d72018-06-22 22:40:1658#include "test/gtest.h"
Seth Hampsond1003d72018-06-22 22:40:1659
60namespace webrtc {
Seth Hampsond1003d72018-06-22 22:40:1661namespace {
Artem Titov2ae3f7b2022-09-24 23:13:1062
63using ::webrtc::test::GetGlobalMetricsLogger;
64using ::webrtc::test::ImprovementDirection;
65using ::webrtc::test::Unit;
66
Seth Hampsond1003d72018-06-22 22:40:1667static const int kDefaultTestTimeMs = 15000;
68static const int kRampUpTimeMs = 5000;
69static const int kPollIntervalTimeMs = 50;
70static const int kDefaultTimeoutMs = 10000;
71static const rtc::SocketAddress kDefaultLocalAddress("1.1.1.1", 0);
Seth Hampsonec207102018-06-29 18:12:1972static const char kTurnInternalAddress[] = "88.88.88.0";
73static const char kTurnExternalAddress[] = "88.88.88.1";
74static const int kTurnInternalPort = 3478;
75static const int kTurnExternalPort = 0;
Seth Hampsond1003d72018-06-22 22:40:1676// The video's configured max bitrate in webrtcvideoengine.cc is 1.7 Mbps.
77// Setting the network bandwidth to 1 Mbps allows the video's bitrate to push
78// the network's limitations.
79static const int kNetworkBandwidth = 1000000;
Artem Titov2ae3f7b2022-09-24 23:13:1080
Seth Hampsond1003d72018-06-22 22:40:1681} // namespace
82
83using RTCConfiguration = PeerConnectionInterface::RTCConfiguration;
84
85// This is an end to end test to verify that BWE is functioning when setting
86// up a one to one call at the PeerConnection level. The intention of the test
87// is to catch potential regressions for different ICE path configurations. The
88// test uses a VirtualSocketServer for it's underlying simulated network and
89// fake audio and video sources. The test is based upon rampup_tests.cc, but
90// instead is at the PeerConnection level and uses a different fake network
91// (rampup_tests.cc uses SimulatedNetwork). In the future, this test could
92// potentially test different network conditions and test video quality as well
93// (video_quality_test.cc does this, but at the call level).
94//
95// The perf test results are printed using the perf test support. If the
96// isolated_script_test_perf_output flag is specified in test_main.cc, then
97// the results are written to a JSON formatted file for the Chrome perf
98// dashboard. Since this test is a webrtc_perf_test, it will be run in the perf
99// console every webrtc commit.
100class PeerConnectionWrapperForRampUpTest : public PeerConnectionWrapper {
101 public:
102 using PeerConnectionWrapper::PeerConnectionWrapper;
103
104 PeerConnectionWrapperForRampUpTest(
105 rtc::scoped_refptr<PeerConnectionFactoryInterface> pc_factory,
106 rtc::scoped_refptr<PeerConnectionInterface> pc,
Seth Hampsonec207102018-06-29 18:12:19107 std::unique_ptr<MockPeerConnectionObserver> observer)
Seth Hampsond1003d72018-06-22 22:40:16108 : PeerConnectionWrapper::PeerConnectionWrapper(pc_factory,
109 pc,
Seth Hampsonec207102018-06-29 18:12:19110 std::move(observer)) {}
Seth Hampsond1003d72018-06-22 22:40:16111
112 bool AddIceCandidates(std::vector<const IceCandidateInterface*> candidates) {
113 bool success = true;
114 for (const auto candidate : candidates) {
115 if (!pc()->AddIceCandidate(candidate)) {
116 success = false;
117 }
118 }
119 return success;
120 }
121
122 rtc::scoped_refptr<VideoTrackInterface> CreateLocalVideoTrack(
123 FrameGeneratorCapturerVideoTrackSource::Config config,
124 Clock* clock) {
125 video_track_sources_.emplace_back(
Tommi87f70902021-04-27 12:43:08126 rtc::make_ref_counted<FrameGeneratorCapturerVideoTrackSource>(
Artem Titov232b6a12019-05-29 09:05:01127 config, clock, /*is_screencast=*/false));
Seth Hampsond1003d72018-06-22 22:40:16128 video_track_sources_.back()->Start();
129 return rtc::scoped_refptr<VideoTrackInterface>(
130 pc_factory()->CreateVideoTrack(rtc::CreateRandomUuid(),
Niels Möllerafb246b2022-04-20 12:26:50131 video_track_sources_.back().get()));
Seth Hampsond1003d72018-06-22 22:40:16132 }
133
134 rtc::scoped_refptr<AudioTrackInterface> CreateLocalAudioTrack(
135 const cricket::AudioOptions options) {
136 rtc::scoped_refptr<AudioSourceInterface> source =
137 pc_factory()->CreateAudioSource(options);
Niels Möllerafb246b2022-04-20 12:26:50138 return pc_factory()->CreateAudioTrack(rtc::CreateRandomUuid(),
139 source.get());
Seth Hampsond1003d72018-06-22 22:40:16140 }
141
142 private:
Seth Hampsond1003d72018-06-22 22:40:16143 std::vector<rtc::scoped_refptr<FrameGeneratorCapturerVideoTrackSource>>
144 video_track_sources_;
145};
146
147// TODO(shampson): Paramaterize the test to run for both Plan B & Unified Plan.
148class PeerConnectionRampUpTest : public ::testing::Test {
149 public:
150 PeerConnectionRampUpTest()
151 : clock_(Clock::GetRealTimeClock()),
152 virtual_socket_server_(new rtc::VirtualSocketServer()),
153 firewall_socket_server_(
154 new rtc::FirewallSocketServer(virtual_socket_server_.get())),
155 network_thread_(new rtc::Thread(firewall_socket_server_.get())),
156 worker_thread_(rtc::Thread::Create()) {
157 network_thread_->SetName("PCNetworkThread", this);
158 worker_thread_->SetName("PCWorkerThread", this);
159 RTC_CHECK(network_thread_->Start());
160 RTC_CHECK(worker_thread_->Start());
161
162 virtual_socket_server_->set_bandwidth(kNetworkBandwidth / 8);
163 pc_factory_ = CreatePeerConnectionFactory(
164 network_thread_.get(), worker_thread_.get(), rtc::Thread::Current(),
165 rtc::scoped_refptr<AudioDeviceModule>(FakeAudioCaptureModule::Create()),
166 CreateBuiltinAudioEncoderFactory(), CreateBuiltinAudioDecoderFactory(),
167 CreateBuiltinVideoEncoderFactory(), CreateBuiltinVideoDecoderFactory(),
168 nullptr /* audio_mixer */, nullptr /* audio_processing */);
169 }
170
171 virtual ~PeerConnectionRampUpTest() {
Danil Chapovalov2aaef452022-08-12 13:55:11172 SendTask(network_thread(), [this] { turn_servers_.clear(); });
Seth Hampsond1003d72018-06-22 22:40:16173 }
174
175 bool CreatePeerConnectionWrappers(const RTCConfiguration& caller_config,
176 const RTCConfiguration& callee_config) {
177 caller_ = CreatePeerConnectionWrapper(caller_config);
178 callee_ = CreatePeerConnectionWrapper(callee_config);
179 return caller_ && callee_;
180 }
181
182 std::unique_ptr<PeerConnectionWrapperForRampUpTest>
183 CreatePeerConnectionWrapper(const RTCConfiguration& config) {
184 auto* fake_network_manager = new rtc::FakeNetworkManager();
185 fake_network_manager->AddInterface(kDefaultLocalAddress);
186 fake_network_managers_.emplace_back(fake_network_manager);
Seth Hampsond1003d72018-06-22 22:40:16187
Mirko Bonadei317a1f02019-09-17 15:06:18188 auto observer = std::make_unique<MockPeerConnectionObserver>();
Seth Hampsonec207102018-06-29 18:12:19189 webrtc::PeerConnectionDependencies dependencies(observer.get());
190 cricket::BasicPortAllocator* port_allocator =
Byoungchan Leed197e0b2022-05-30 14:59:55191 new cricket::BasicPortAllocator(
192 fake_network_manager,
193 std::make_unique<rtc::BasicPacketSocketFactory>(
194 firewall_socket_server_.get()));
Seth Hampsonec207102018-06-29 18:12:19195 port_allocator->set_step_delay(cricket::kDefaultStepDelay);
196 dependencies.allocator =
197 std::unique_ptr<cricket::BasicPortAllocator>(port_allocator);
198 dependencies.tls_cert_verifier =
Mirko Bonadei317a1f02019-09-17 15:06:18199 std::make_unique<rtc::TestCertificateVerifier>();
Seth Hampsonec207102018-06-29 18:12:19200
Harald Alvestrandf33f7a22021-05-09 14:58:57201 auto result = pc_factory_->CreatePeerConnectionOrError(
202 config, std::move(dependencies));
203 if (!result.ok()) {
Seth Hampsond1003d72018-06-22 22:40:16204 return nullptr;
205 }
206
Mirko Bonadei317a1f02019-09-17 15:06:18207 return std::make_unique<PeerConnectionWrapperForRampUpTest>(
Harald Alvestrandf33f7a22021-05-09 14:58:57208 pc_factory_, result.MoveValue(), std::move(observer));
Seth Hampsond1003d72018-06-22 22:40:16209 }
210
211 void SetupOneWayCall() {
212 ASSERT_TRUE(caller_);
213 ASSERT_TRUE(callee_);
214 FrameGeneratorCapturerVideoTrackSource::Config config;
215 caller_->AddTrack(caller_->CreateLocalVideoTrack(config, clock_));
216 // Disable highpass filter so that we can get all the test audio frames.
217 cricket::AudioOptions options;
218 options.highpass_filter = false;
219 caller_->AddTrack(caller_->CreateLocalAudioTrack(options));
220
221 // Do the SDP negotiation, and also exchange ice candidates.
222 ASSERT_TRUE(caller_->ExchangeOfferAnswerWith(callee_.get()));
223 ASSERT_TRUE_WAIT(
224 caller_->signaling_state() == PeerConnectionInterface::kStable,
225 kDefaultTimeoutMs);
226 ASSERT_TRUE_WAIT(caller_->IsIceGatheringDone(), kDefaultTimeoutMs);
227 ASSERT_TRUE_WAIT(callee_->IsIceGatheringDone(), kDefaultTimeoutMs);
228
229 // Connect an ICE candidate pairs.
230 ASSERT_TRUE(
231 callee_->AddIceCandidates(caller_->observer()->GetAllCandidates()));
232 ASSERT_TRUE(
233 caller_->AddIceCandidates(callee_->observer()->GetAllCandidates()));
234 // This means that ICE and DTLS are connected.
235 ASSERT_TRUE_WAIT(callee_->IsIceConnected(), kDefaultTimeoutMs);
236 ASSERT_TRUE_WAIT(caller_->IsIceConnected(), kDefaultTimeoutMs);
237 }
238
Seth Hampsonec207102018-06-29 18:12:19239 void CreateTurnServer(cricket::ProtocolType type,
240 const std::string& common_name = "test turn server") {
Seth Hampsond1003d72018-06-22 22:40:16241 rtc::Thread* thread = network_thread();
Niels Möller6dd49972021-11-24 13:05:55242 rtc::SocketFactory* factory = firewall_socket_server_.get();
Danil Chapovalov2aaef452022-08-12 13:55:11243 std::unique_ptr<cricket::TestTurnServer> turn_server;
244 SendTask(network_thread_.get(), [&] {
245 static const rtc::SocketAddress turn_server_internal_address{
246 kTurnInternalAddress, kTurnInternalPort};
247 static const rtc::SocketAddress turn_server_external_address{
248 kTurnExternalAddress, kTurnExternalPort};
249 turn_server = std::make_unique<cricket::TestTurnServer>(
250 thread, factory, turn_server_internal_address,
251 turn_server_external_address, type, true /*ignore_bad_certs=*/,
252 common_name);
253 });
Seth Hampsond1003d72018-06-22 22:40:16254 turn_servers_.push_back(std::move(turn_server));
255 }
256
257 // First runs the call for kRampUpTimeMs to ramp up the bandwidth estimate.
258 // Then runs the test for the remaining test time, grabbing the bandwidth
259 // estimation stat, every kPollIntervalTimeMs. When finished, averages the
260 // bandwidth estimations and prints the bandwidth estimation result as a perf
261 // metric.
262 void RunTest(const std::string& test_string) {
263 rtc::Thread::Current()->ProcessMessages(kRampUpTimeMs);
264 int number_of_polls =
265 (kDefaultTestTimeMs - kRampUpTimeMs) / kPollIntervalTimeMs;
266 int total_bwe = 0;
267 for (int i = 0; i < number_of_polls; ++i) {
268 rtc::Thread::Current()->ProcessMessages(kPollIntervalTimeMs);
269 total_bwe += static_cast<int>(GetCallerAvailableBitrateEstimate());
270 }
271 double average_bandwidth_estimate = total_bwe / number_of_polls;
272 std::string value_description =
273 "bwe_after_" + std::to_string(kDefaultTestTimeMs / 1000) + "_seconds";
Artem Titov2ae3f7b2022-09-24 23:13:10274 GetGlobalMetricsLogger()->LogSingleValueMetric(
275 "peerconnection_ramp_up_" + test_string, value_description,
276 average_bandwidth_estimate, Unit::kUnitless,
277 ImprovementDirection::kNeitherIsBetter);
Seth Hampsond1003d72018-06-22 22:40:16278 }
279
280 rtc::Thread* network_thread() { return network_thread_.get(); }
281
Seth Hampsonec207102018-06-29 18:12:19282 rtc::FirewallSocketServer* firewall_socket_server() {
283 return firewall_socket_server_.get();
284 }
285
Seth Hampsond1003d72018-06-22 22:40:16286 PeerConnectionWrapperForRampUpTest* caller() { return caller_.get(); }
287
288 PeerConnectionWrapperForRampUpTest* callee() { return callee_.get(); }
289
290 private:
291 // Gets the caller's outgoing available bitrate from the stats. Returns 0 if
292 // something went wrong. It takes the outgoing bitrate from the current
293 // selected ICE candidate pair's stats.
294 double GetCallerAvailableBitrateEstimate() {
295 auto stats = caller_->GetStats();
296 auto transport_stats = stats->GetStatsOfType<RTCTransportStats>();
297 if (transport_stats.size() == 0u ||
298 !transport_stats[0]->selected_candidate_pair_id.is_defined()) {
299 return 0;
300 }
301 std::string selected_ice_id =
302 transport_stats[0]->selected_candidate_pair_id.ValueToString();
303 // Use the selected ICE candidate pair ID to get the appropriate ICE stats.
304 const RTCIceCandidatePairStats ice_candidate_pair_stats =
305 stats->Get(selected_ice_id)->cast_to<const RTCIceCandidatePairStats>();
306 if (ice_candidate_pair_stats.available_outgoing_bitrate.is_defined()) {
307 return *ice_candidate_pair_stats.available_outgoing_bitrate;
308 }
Artem Titov880fa812021-07-30 20:30:23309 // We couldn't get the `available_outgoing_bitrate` for the active candidate
Seth Hampsond1003d72018-06-22 22:40:16310 // pair.
311 return 0;
312 }
313
314 Clock* const clock_;
315 // The turn servers should be accessed & deleted on the network thread to
316 // avoid a race with the socket read/write which occurs on the network thread.
317 std::vector<std::unique_ptr<cricket::TestTurnServer>> turn_servers_;
Artem Titov880fa812021-07-30 20:30:23318 // `virtual_socket_server_` is used by `network_thread_` so it must be
Seth Hampsond1003d72018-06-22 22:40:16319 // destroyed later.
320 // TODO(bugs.webrtc.org/7668): We would like to update the virtual network we
321 // use for this test. VirtualSocketServer isn't ideal because:
322 // 1) It uses the same queue & network capacity for both directions.
323 // 2) VirtualSocketServer implements how the network bandwidth affects the
324 // send delay differently than the SimulatedNetwork, used by the
325 // FakeNetworkPipe. It would be ideal if all of levels of virtual
326 // networks used in testing were consistent.
327 // We would also like to update this test to record the time to ramp up,
328 // down, and back up (similar to in rampup_tests.cc). This is problematic with
329 // the VirtualSocketServer. The first ramp down time is very noisy and the
330 // second ramp up time can take up to 300 seconds, most likely due to a built
331 // up queue.
332 std::unique_ptr<rtc::VirtualSocketServer> virtual_socket_server_;
333 std::unique_ptr<rtc::FirewallSocketServer> firewall_socket_server_;
334 std::unique_ptr<rtc::Thread> network_thread_;
335 std::unique_ptr<rtc::Thread> worker_thread_;
Artem Titov880fa812021-07-30 20:30:23336 // The `pc_factory` uses `network_thread_` & `worker_thread_`, so it must be
Seth Hampsond1003d72018-06-22 22:40:16337 // destroyed first.
338 std::vector<std::unique_ptr<rtc::FakeNetworkManager>> fake_network_managers_;
339 rtc::scoped_refptr<PeerConnectionFactoryInterface> pc_factory_;
340 std::unique_ptr<PeerConnectionWrapperForRampUpTest> caller_;
341 std::unique_ptr<PeerConnectionWrapperForRampUpTest> callee_;
342};
343
Jeremy Lecontec8850cb2020-09-10 18:46:33344TEST_F(PeerConnectionRampUpTest, Bwe_After_TurnOverTCP) {
Seth Hampsond1003d72018-06-22 22:40:16345 CreateTurnServer(cricket::ProtocolType::PROTO_TCP);
346 PeerConnectionInterface::IceServer ice_server;
Seth Hampsonec207102018-06-29 18:12:19347 std::string ice_server_url = "turn:" + std::string(kTurnInternalAddress) +
348 ":" + std::to_string(kTurnInternalPort) +
349 "?transport=tcp";
350 ice_server.urls.push_back(ice_server_url);
Seth Hampsond1003d72018-06-22 22:40:16351 ice_server.username = "test";
352 ice_server.password = "test";
353 PeerConnectionInterface::RTCConfiguration client_1_config;
Henrik Boström62995db2022-01-03 08:58:10354 client_1_config.sdp_semantics = SdpSemantics::kUnifiedPlan;
Seth Hampsond1003d72018-06-22 22:40:16355 client_1_config.servers.push_back(ice_server);
356 client_1_config.type = PeerConnectionInterface::kRelay;
357 PeerConnectionInterface::RTCConfiguration client_2_config;
Henrik Boström62995db2022-01-03 08:58:10358 client_2_config.sdp_semantics = SdpSemantics::kUnifiedPlan;
Seth Hampsond1003d72018-06-22 22:40:16359 client_2_config.servers.push_back(ice_server);
360 client_2_config.type = PeerConnectionInterface::kRelay;
361 ASSERT_TRUE(CreatePeerConnectionWrappers(client_1_config, client_2_config));
362
363 SetupOneWayCall();
364 RunTest("turn_over_tcp");
365}
366
Jeremy Lecontec8850cb2020-09-10 18:46:33367TEST_F(PeerConnectionRampUpTest, Bwe_After_TurnOverUDP) {
Seth Hampsonec207102018-06-29 18:12:19368 CreateTurnServer(cricket::ProtocolType::PROTO_UDP);
369 PeerConnectionInterface::IceServer ice_server;
370 std::string ice_server_url = "turn:" + std::string(kTurnInternalAddress) +
371 ":" + std::to_string(kTurnInternalPort);
372
373 ice_server.urls.push_back(ice_server_url);
374 ice_server.username = "test";
375 ice_server.password = "test";
376 PeerConnectionInterface::RTCConfiguration client_1_config;
Henrik Boström62995db2022-01-03 08:58:10377 client_1_config.sdp_semantics = SdpSemantics::kUnifiedPlan;
Seth Hampsonec207102018-06-29 18:12:19378 client_1_config.servers.push_back(ice_server);
379 client_1_config.type = PeerConnectionInterface::kRelay;
380 PeerConnectionInterface::RTCConfiguration client_2_config;
Henrik Boström62995db2022-01-03 08:58:10381 client_2_config.sdp_semantics = SdpSemantics::kUnifiedPlan;
Seth Hampsonec207102018-06-29 18:12:19382 client_2_config.servers.push_back(ice_server);
383 client_2_config.type = PeerConnectionInterface::kRelay;
384 ASSERT_TRUE(CreatePeerConnectionWrappers(client_1_config, client_2_config));
385
386 SetupOneWayCall();
387 RunTest("turn_over_udp");
388}
389
Jeremy Lecontec8850cb2020-09-10 18:46:33390TEST_F(PeerConnectionRampUpTest, Bwe_After_TurnOverTLS) {
Seth Hampsonec207102018-06-29 18:12:19391 CreateTurnServer(cricket::ProtocolType::PROTO_TLS, kTurnInternalAddress);
392 PeerConnectionInterface::IceServer ice_server;
393 std::string ice_server_url = "turns:" + std::string(kTurnInternalAddress) +
394 ":" + std::to_string(kTurnInternalPort) +
395 "?transport=tcp";
396 ice_server.urls.push_back(ice_server_url);
397 ice_server.username = "test";
398 ice_server.password = "test";
399 PeerConnectionInterface::RTCConfiguration client_1_config;
Henrik Boström62995db2022-01-03 08:58:10400 client_1_config.sdp_semantics = SdpSemantics::kUnifiedPlan;
Seth Hampsonec207102018-06-29 18:12:19401 client_1_config.servers.push_back(ice_server);
402 client_1_config.type = PeerConnectionInterface::kRelay;
403 PeerConnectionInterface::RTCConfiguration client_2_config;
Henrik Boström62995db2022-01-03 08:58:10404 client_2_config.sdp_semantics = SdpSemantics::kUnifiedPlan;
Seth Hampsonec207102018-06-29 18:12:19405 client_2_config.servers.push_back(ice_server);
406 client_2_config.type = PeerConnectionInterface::kRelay;
407
408 ASSERT_TRUE(CreatePeerConnectionWrappers(client_1_config, client_2_config));
409
410 SetupOneWayCall();
411 RunTest("turn_over_tls");
412}
413
Jeremy Lecontec8850cb2020-09-10 18:46:33414TEST_F(PeerConnectionRampUpTest, Bwe_After_UDPPeerToPeer) {
Seth Hampsonec207102018-06-29 18:12:19415 PeerConnectionInterface::RTCConfiguration client_1_config;
Henrik Boström62995db2022-01-03 08:58:10416 client_1_config.sdp_semantics = SdpSemantics::kUnifiedPlan;
Seth Hampsonec207102018-06-29 18:12:19417 client_1_config.tcp_candidate_policy =
418 PeerConnection::kTcpCandidatePolicyDisabled;
419 PeerConnectionInterface::RTCConfiguration client_2_config;
Henrik Boström62995db2022-01-03 08:58:10420 client_2_config.sdp_semantics = SdpSemantics::kUnifiedPlan;
Seth Hampsonec207102018-06-29 18:12:19421 client_2_config.tcp_candidate_policy =
422 PeerConnection::kTcpCandidatePolicyDisabled;
423 ASSERT_TRUE(CreatePeerConnectionWrappers(client_1_config, client_2_config));
424
425 SetupOneWayCall();
426 RunTest("udp_peer_to_peer");
427}
428
Jeremy Lecontec8850cb2020-09-10 18:46:33429TEST_F(PeerConnectionRampUpTest, Bwe_After_TCPPeerToPeer) {
Seth Hampsonec207102018-06-29 18:12:19430 firewall_socket_server()->set_udp_sockets_enabled(false);
Henrik Boström62995db2022-01-03 08:58:10431 PeerConnectionInterface::RTCConfiguration config;
432 config.sdp_semantics = SdpSemantics::kUnifiedPlan;
433 ASSERT_TRUE(CreatePeerConnectionWrappers(config, config));
Seth Hampsonec207102018-06-29 18:12:19434
435 SetupOneWayCall();
436 RunTest("tcp_peer_to_peer");
437}
Seth Hampsond1003d72018-06-22 22:40:16438
439} // namespace webrtc