OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/call/rampup_tests.h" | 11 #include "webrtc/call/rampup_tests.h" |
12 | 12 |
13 #include "webrtc/base/checks.h" | 13 #include "webrtc/base/checks.h" |
| 14 #include "webrtc/base/logging.h" |
14 #include "webrtc/base/platform_thread.h" | 15 #include "webrtc/base/platform_thread.h" |
15 #include "webrtc/test/encoder_settings.h" | 16 #include "webrtc/test/encoder_settings.h" |
16 #include "webrtc/test/gtest.h" | 17 #include "webrtc/test/gtest.h" |
17 #include "webrtc/test/testsupport/perf_test.h" | 18 #include "webrtc/test/testsupport/perf_test.h" |
18 | 19 |
19 namespace webrtc { | 20 namespace webrtc { |
20 namespace { | 21 namespace { |
21 | 22 |
22 static const int64_t kPollIntervalMs = 20; | 23 static const int64_t kPollIntervalMs = 20; |
23 static const int kExpectedHighVideoBitrateBps = 60000; | 24 static const int kExpectedHighVideoBitrateBps = 80000; |
24 static const int kExpectedHighAudioBitrateBps = 30000; | 25 static const int kExpectedHighAudioBitrateBps = 30000; |
25 static const int kLowBandwidthLimitBps = 20000; | 26 static const int kLowBandwidthLimitBps = 20000; |
26 static const int kExpectedLowBitrateBps = 20000; | 27 static const int kExpectedLowBitrateBps = 20000; |
27 | 28 |
28 std::vector<uint32_t> GenerateSsrcs(size_t num_streams, uint32_t ssrc_offset) { | 29 std::vector<uint32_t> GenerateSsrcs(size_t num_streams, uint32_t ssrc_offset) { |
29 std::vector<uint32_t> ssrcs; | 30 std::vector<uint32_t> ssrcs; |
30 for (size_t i = 0; i != num_streams; ++i) | 31 for (size_t i = 0; i != num_streams; ++i) |
31 ssrcs.push_back(static_cast<uint32_t>(ssrc_offset + i)); | 32 ssrcs.push_back(static_cast<uint32_t>(ssrc_offset + i)); |
32 return ssrcs; | 33 return ssrcs; |
33 } | 34 } |
34 } // namespace | 35 } // namespace |
35 | 36 |
36 RampUpTester::RampUpTester(size_t num_video_streams, | 37 RampUpTester::RampUpTester(size_t num_video_streams, |
37 size_t num_audio_streams, | 38 size_t num_audio_streams, |
| 39 size_t num_flexfec_streams, |
38 unsigned int start_bitrate_bps, | 40 unsigned int start_bitrate_bps, |
39 int64_t min_run_time_ms, | 41 int64_t min_run_time_ms, |
40 const std::string& extension_type, | 42 const std::string& extension_type, |
41 bool rtx, | 43 bool rtx, |
42 bool red, | 44 bool red, |
43 bool report_perf_stats) | 45 bool report_perf_stats) |
44 : EndToEndTest(test::CallTest::kLongTimeoutMs), | 46 : EndToEndTest(test::CallTest::kLongTimeoutMs), |
45 event_(false, false), | 47 event_(false, false), |
46 clock_(Clock::GetRealTimeClock()), | 48 clock_(Clock::GetRealTimeClock()), |
47 num_video_streams_(num_video_streams), | 49 num_video_streams_(num_video_streams), |
48 num_audio_streams_(num_audio_streams), | 50 num_audio_streams_(num_audio_streams), |
| 51 num_flexfec_streams_(num_flexfec_streams), |
49 rtx_(rtx), | 52 rtx_(rtx), |
50 red_(red), | 53 red_(red), |
51 sender_call_(nullptr), | 54 sender_call_(nullptr), |
52 send_stream_(nullptr), | 55 send_stream_(nullptr), |
53 start_bitrate_bps_(start_bitrate_bps), | 56 start_bitrate_bps_(start_bitrate_bps), |
54 min_run_time_ms_(min_run_time_ms), | 57 min_run_time_ms_(min_run_time_ms), |
55 report_perf_stats_(report_perf_stats), | 58 report_perf_stats_(report_perf_stats), |
56 expected_bitrate_bps_(0), | 59 expected_bitrate_bps_(0), |
57 test_start_ms_(-1), | 60 test_start_ms_(-1), |
58 ramp_up_finished_ms_(-1), | 61 ramp_up_finished_ms_(-1), |
59 extension_type_(extension_type), | 62 extension_type_(extension_type), |
60 video_ssrcs_(GenerateSsrcs(num_video_streams_, 100)), | 63 video_ssrcs_(GenerateSsrcs(num_video_streams_, 100)), |
61 video_rtx_ssrcs_(GenerateSsrcs(num_video_streams_, 200)), | 64 video_rtx_ssrcs_(GenerateSsrcs(num_video_streams_, 200)), |
62 audio_ssrcs_(GenerateSsrcs(num_audio_streams_, 300)), | 65 audio_ssrcs_(GenerateSsrcs(num_audio_streams_, 300)), |
63 poller_thread_(&BitrateStatsPollingThread, | 66 poller_thread_(&BitrateStatsPollingThread, |
64 this, | 67 this, |
65 "BitrateStatsPollingThread") { | 68 "BitrateStatsPollingThread") { |
| 69 if (red_) |
| 70 EXPECT_EQ(0u, num_flexfec_streams_); |
66 EXPECT_LE(num_audio_streams_, 1u); | 71 EXPECT_LE(num_audio_streams_, 1u); |
67 } | 72 } |
68 | 73 |
69 RampUpTester::~RampUpTester() { | 74 RampUpTester::~RampUpTester() { |
70 event_.Set(); | 75 event_.Set(); |
71 } | 76 } |
72 | 77 |
73 Call::Config RampUpTester::GetSenderCallConfig() { | 78 Call::Config RampUpTester::GetSenderCallConfig() { |
74 Call::Config call_config(&event_log_); | 79 Call::Config call_config(&event_log_); |
75 if (start_bitrate_bps_ != 0) { | 80 if (start_bitrate_bps_ != 0) { |
(...skipping 17 matching lines...) Expand all Loading... |
93 } | 98 } |
94 | 99 |
95 size_t RampUpTester::GetNumVideoStreams() const { | 100 size_t RampUpTester::GetNumVideoStreams() const { |
96 return num_video_streams_; | 101 return num_video_streams_; |
97 } | 102 } |
98 | 103 |
99 size_t RampUpTester::GetNumAudioStreams() const { | 104 size_t RampUpTester::GetNumAudioStreams() const { |
100 return num_audio_streams_; | 105 return num_audio_streams_; |
101 } | 106 } |
102 | 107 |
| 108 size_t RampUpTester::GetNumFlexfecStreams() const { |
| 109 return num_flexfec_streams_; |
| 110 } |
| 111 |
103 class RampUpTester::VideoStreamFactory | 112 class RampUpTester::VideoStreamFactory |
104 : public VideoEncoderConfig::VideoStreamFactoryInterface { | 113 : public VideoEncoderConfig::VideoStreamFactoryInterface { |
105 public: | 114 public: |
106 VideoStreamFactory() {} | 115 VideoStreamFactory() {} |
107 | 116 |
108 private: | 117 private: |
109 std::vector<VideoStream> CreateEncoderStreams( | 118 std::vector<VideoStream> CreateEncoderStreams( |
110 int width, | 119 int width, |
111 int height, | 120 int height, |
112 const VideoEncoderConfig& encoder_config) override { | 121 const VideoEncoderConfig& encoder_config) override { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 } | 211 } |
203 | 212 |
204 if (rtx_) { | 213 if (rtx_) { |
205 recv_config.rtp.rtx_ssrc = video_rtx_ssrcs_[i]; | 214 recv_config.rtp.rtx_ssrc = video_rtx_ssrcs_[i]; |
206 recv_config.rtp | 215 recv_config.rtp |
207 .rtx_payload_types[send_config->encoder_settings.payload_type] = | 216 .rtx_payload_types[send_config->encoder_settings.payload_type] = |
208 send_config->rtp.rtx.payload_type; | 217 send_config->rtp.rtx.payload_type; |
209 } | 218 } |
210 ++i; | 219 ++i; |
211 } | 220 } |
| 221 |
| 222 RTC_DCHECK_LE(num_flexfec_streams_, 1); |
| 223 if (num_flexfec_streams_ == 1) { |
| 224 send_config->rtp.flexfec.payload_type = test::CallTest::kFlexfecPayloadType; |
| 225 send_config->rtp.flexfec.ssrc = test::CallTest::kFlexfecSendSsrc; |
| 226 send_config->rtp.flexfec.protected_media_ssrcs = {video_ssrcs_[0]}; |
| 227 } |
212 } | 228 } |
213 | 229 |
214 void RampUpTester::ModifyAudioConfigs( | 230 void RampUpTester::ModifyAudioConfigs( |
215 AudioSendStream::Config* send_config, | 231 AudioSendStream::Config* send_config, |
216 std::vector<AudioReceiveStream::Config>* receive_configs) { | 232 std::vector<AudioReceiveStream::Config>* receive_configs) { |
217 if (num_audio_streams_ == 0) | 233 if (num_audio_streams_ == 0) |
218 return; | 234 return; |
219 | 235 |
220 EXPECT_NE(RtpExtension::kTimestampOffsetUri, extension_type_) | 236 EXPECT_NE(RtpExtension::kTimestampOffsetUri, extension_type_) |
221 << "Audio BWE not supported with toffset."; | 237 << "Audio BWE not supported with toffset."; |
| 238 EXPECT_NE(RtpExtension::kAbsSendTimeUri, extension_type_) |
| 239 << "Audio BWE not supported with abs-send-time."; |
222 | 240 |
223 send_config->rtp.ssrc = audio_ssrcs_[0]; | 241 send_config->rtp.ssrc = audio_ssrcs_[0]; |
224 send_config->rtp.extensions.clear(); | 242 send_config->rtp.extensions.clear(); |
225 | 243 |
226 send_config->min_bitrate_bps = 6000; | 244 send_config->min_bitrate_bps = 6000; |
227 send_config->max_bitrate_bps = 60000; | 245 send_config->max_bitrate_bps = 60000; |
228 | 246 |
229 bool transport_cc = false; | 247 bool transport_cc = false; |
230 if (extension_type_ == RtpExtension::kAbsSendTimeUri) { | 248 if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) { |
231 transport_cc = false; | |
232 send_config->rtp.extensions.push_back( | |
233 RtpExtension(extension_type_.c_str(), kAbsSendTimeExtensionId)); | |
234 } else if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) { | |
235 transport_cc = true; | 249 transport_cc = true; |
236 send_config->rtp.extensions.push_back(RtpExtension( | 250 send_config->rtp.extensions.push_back(RtpExtension( |
237 extension_type_.c_str(), kTransportSequenceNumberExtensionId)); | 251 extension_type_.c_str(), kTransportSequenceNumberExtensionId)); |
238 } | 252 } |
239 | 253 |
240 for (AudioReceiveStream::Config& recv_config : *receive_configs) { | 254 for (AudioReceiveStream::Config& recv_config : *receive_configs) { |
241 recv_config.rtp.transport_cc = transport_cc; | 255 recv_config.rtp.transport_cc = transport_cc; |
242 recv_config.rtp.extensions = send_config->rtp.extensions; | 256 recv_config.rtp.extensions = send_config->rtp.extensions; |
243 recv_config.rtp.remote_ssrc = send_config->rtp.ssrc; | 257 recv_config.rtp.remote_ssrc = send_config->rtp.ssrc; |
244 } | 258 } |
245 } | 259 } |
246 | 260 |
| 261 void RampUpTester::ModifyFlexfecConfigs( |
| 262 std::vector<FlexfecReceiveStream::Config>* receive_configs) { |
| 263 if (num_flexfec_streams_ == 0) |
| 264 return; |
| 265 RTC_DCHECK_EQ(1, num_flexfec_streams_); |
| 266 (*receive_configs)[0].payload_type = test::CallTest::kFlexfecPayloadType; |
| 267 (*receive_configs)[0].remote_ssrc = test::CallTest::kFlexfecSendSsrc; |
| 268 (*receive_configs)[0].protected_media_ssrcs = {video_ssrcs_[0]}; |
| 269 (*receive_configs)[0].local_ssrc = video_ssrcs_[0]; |
| 270 if (extension_type_ == RtpExtension::kAbsSendTimeUri) { |
| 271 (*receive_configs)[0].transport_cc = false; |
| 272 (*receive_configs)[0].rtp_header_extensions.push_back( |
| 273 RtpExtension(extension_type_.c_str(), kAbsSendTimeExtensionId)); |
| 274 } else if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) { |
| 275 (*receive_configs)[0].transport_cc = true; |
| 276 (*receive_configs)[0].rtp_header_extensions.push_back(RtpExtension( |
| 277 extension_type_.c_str(), kTransportSequenceNumberExtensionId)); |
| 278 } |
| 279 } |
| 280 |
247 void RampUpTester::OnCallsCreated(Call* sender_call, Call* receiver_call) { | 281 void RampUpTester::OnCallsCreated(Call* sender_call, Call* receiver_call) { |
248 sender_call_ = sender_call; | 282 sender_call_ = sender_call; |
249 } | 283 } |
250 | 284 |
251 bool RampUpTester::BitrateStatsPollingThread(void* obj) { | 285 bool RampUpTester::BitrateStatsPollingThread(void* obj) { |
252 return static_cast<RampUpTester*>(obj)->PollStats(); | 286 return static_cast<RampUpTester*>(obj)->PollStats(); |
253 } | 287 } |
254 | 288 |
255 bool RampUpTester::PollStats() { | 289 bool RampUpTester::PollStats() { |
256 if (sender_call_) { | 290 if (sender_call_) { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 void RampUpTester::PerformTest() { | 378 void RampUpTester::PerformTest() { |
345 test_start_ms_ = clock_->TimeInMilliseconds(); | 379 test_start_ms_ = clock_->TimeInMilliseconds(); |
346 poller_thread_.Start(); | 380 poller_thread_.Start(); |
347 EXPECT_TRUE(Wait()) << "Timed out while waiting for ramp-up to complete."; | 381 EXPECT_TRUE(Wait()) << "Timed out while waiting for ramp-up to complete."; |
348 TriggerTestDone(); | 382 TriggerTestDone(); |
349 poller_thread_.Stop(); | 383 poller_thread_.Stop(); |
350 } | 384 } |
351 | 385 |
352 RampUpDownUpTester::RampUpDownUpTester(size_t num_video_streams, | 386 RampUpDownUpTester::RampUpDownUpTester(size_t num_video_streams, |
353 size_t num_audio_streams, | 387 size_t num_audio_streams, |
| 388 size_t num_flexfec_streams, |
354 unsigned int start_bitrate_bps, | 389 unsigned int start_bitrate_bps, |
355 const std::string& extension_type, | 390 const std::string& extension_type, |
356 bool rtx, | 391 bool rtx, |
357 bool red) | 392 bool red, |
| 393 const std::vector<int>& loss_rates) |
358 : RampUpTester(num_video_streams, | 394 : RampUpTester(num_video_streams, |
359 num_audio_streams, | 395 num_audio_streams, |
| 396 num_flexfec_streams, |
360 start_bitrate_bps, | 397 start_bitrate_bps, |
361 0, | 398 0, |
362 extension_type, | 399 extension_type, |
363 rtx, | 400 rtx, |
364 red, | 401 red, |
365 true), | 402 true), |
| 403 link_rates_({GetHighLinkCapacity(), kLowBandwidthLimitBps / 1000, |
| 404 GetHighLinkCapacity(), 0}), |
366 test_state_(kFirstRampup), | 405 test_state_(kFirstRampup), |
| 406 next_state_(kTransitionToNextState), |
367 state_start_ms_(clock_->TimeInMilliseconds()), | 407 state_start_ms_(clock_->TimeInMilliseconds()), |
368 interval_start_ms_(clock_->TimeInMilliseconds()), | 408 interval_start_ms_(clock_->TimeInMilliseconds()), |
369 sent_bytes_(0) { | 409 sent_bytes_(0), |
370 forward_transport_config_.link_capacity_kbps = GetHighLinkCapacity(); | 410 loss_rates_(loss_rates) { |
| 411 forward_transport_config_.link_capacity_kbps = link_rates_[test_state_]; |
| 412 forward_transport_config_.queue_delay_ms = 100; |
| 413 forward_transport_config_.loss_percent = loss_rates_[test_state_]; |
371 } | 414 } |
372 | 415 |
373 RampUpDownUpTester::~RampUpDownUpTester() {} | 416 RampUpDownUpTester::~RampUpDownUpTester() {} |
374 | 417 |
375 bool RampUpDownUpTester::PollStats() { | 418 bool RampUpDownUpTester::PollStats() { |
376 if (send_stream_) { | 419 if (send_stream_) { |
377 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats(); | 420 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats(); |
378 int transmit_bitrate_bps = 0; | 421 int transmit_bitrate_bps = 0; |
379 for (auto it : stats.substreams) { | 422 for (auto it : stats.substreams) { |
380 transmit_bitrate_bps += it.second.total_bitrate_bps; | 423 transmit_bitrate_bps += it.second.total_bitrate_bps; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 expected_bitrate_bps += kExpectedHighAudioBitrateBps; | 468 expected_bitrate_bps += kExpectedHighAudioBitrateBps; |
426 if (num_video_streams_ > 0) | 469 if (num_video_streams_ > 0) |
427 expected_bitrate_bps += kExpectedHighVideoBitrateBps; | 470 expected_bitrate_bps += kExpectedHighVideoBitrateBps; |
428 return expected_bitrate_bps; | 471 return expected_bitrate_bps; |
429 } | 472 } |
430 | 473 |
431 int RampUpDownUpTester::GetHighLinkCapacity() const { | 474 int RampUpDownUpTester::GetHighLinkCapacity() const { |
432 return 4 * GetExpectedHighBitrate() / (3 * 1000); | 475 return 4 * GetExpectedHighBitrate() / (3 * 1000); |
433 } | 476 } |
434 | 477 |
| 478 size_t RampUpDownUpTester::GetFecBytes() const { |
| 479 size_t flex_fec_bytes = 0; |
| 480 if (num_flexfec_streams_ > 0) { |
| 481 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats(); |
| 482 for (const auto& kv : stats.substreams) |
| 483 flex_fec_bytes += kv.second.rtp_stats.fec.TotalBytes(); |
| 484 } |
| 485 return flex_fec_bytes; |
| 486 } |
| 487 |
| 488 bool RampUpDownUpTester::ExpectingFec() const { |
| 489 return num_flexfec_streams_ > 0 && forward_transport_config_.loss_percent > 0; |
| 490 } |
| 491 |
435 void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) { | 492 void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) { |
436 int64_t now = clock_->TimeInMilliseconds(); | 493 int64_t now = clock_->TimeInMilliseconds(); |
437 switch (test_state_) { | 494 switch (test_state_) { |
438 case kFirstRampup: { | 495 case kFirstRampup: |
439 EXPECT_FALSE(suspended); | 496 EXPECT_FALSE(suspended); |
440 if (bitrate_bps >= GetExpectedHighBitrate()) { | 497 if (bitrate_bps >= GetExpectedHighBitrate()) { |
441 // The first ramp-up has reached the target bitrate. Change the | |
442 // channel limit, and move to the next test state. | |
443 forward_transport_config_.link_capacity_kbps = | |
444 kLowBandwidthLimitBps / 1000; | |
445 send_transport_->SetConfig(forward_transport_config_); | |
446 test_state_ = kLowRate; | |
447 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(), | 498 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(), |
448 "first_rampup", now - state_start_ms_, "ms", | 499 "first_rampup", now - state_start_ms_, "ms", |
449 false); | 500 false); |
450 state_start_ms_ = now; | 501 // Apply loss during the transition between states if FEC is enabled. |
451 interval_start_ms_ = now; | 502 forward_transport_config_.loss_percent = loss_rates_[test_state_]; |
452 sent_bytes_ = 0; | 503 test_state_ = kTransitionToNextState; |
| 504 next_state_ = kLowRate; |
453 } | 505 } |
454 break; | 506 break; |
455 } | |
456 case kLowRate: { | 507 case kLowRate: { |
457 // Audio streams are never suspended. | 508 // Audio streams are never suspended. |
458 bool check_suspend_state = num_video_streams_ > 0; | 509 bool check_suspend_state = num_video_streams_ > 0; |
459 if (bitrate_bps < kExpectedLowBitrateBps && | 510 if (bitrate_bps < kExpectedLowBitrateBps && |
460 suspended == check_suspend_state) { | 511 suspended == check_suspend_state) { |
461 // The ramp-down was successful. Change the channel limit back to a | |
462 // high value, and move to the next test state. | |
463 forward_transport_config_.link_capacity_kbps = GetHighLinkCapacity(); | |
464 send_transport_->SetConfig(forward_transport_config_); | |
465 test_state_ = kSecondRampup; | |
466 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(), | 512 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(), |
467 "rampdown", now - state_start_ms_, "ms", | 513 "rampdown", now - state_start_ms_, "ms", |
468 false); | 514 false); |
469 state_start_ms_ = now; | 515 // Apply loss during the transition between states if FEC is enabled. |
470 interval_start_ms_ = now; | 516 forward_transport_config_.loss_percent = loss_rates_[test_state_]; |
471 sent_bytes_ = 0; | 517 test_state_ = kTransitionToNextState; |
| 518 next_state_ = kSecondRampup; |
472 } | 519 } |
473 break; | 520 break; |
474 } | 521 } |
475 case kSecondRampup: { | 522 case kSecondRampup: |
476 if (bitrate_bps >= GetExpectedHighBitrate() && !suspended) { | 523 if (bitrate_bps >= GetExpectedHighBitrate() && !suspended) { |
477 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(), | 524 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(), |
478 "second_rampup", now - state_start_ms_, "ms", | 525 "second_rampup", now - state_start_ms_, "ms", |
479 false); | 526 false); |
480 ReportResult("ramp-up-down-up-average-network-latency", | 527 ReportResult("ramp-up-down-up-average-network-latency", |
481 send_transport_->GetAverageDelayMs(), "milliseconds"); | 528 send_transport_->GetAverageDelayMs(), "milliseconds"); |
482 observation_complete_.Set(); | 529 // Apply loss during the transition between states if FEC is enabled. |
| 530 forward_transport_config_.loss_percent = loss_rates_[test_state_]; |
| 531 test_state_ = kTransitionToNextState; |
| 532 next_state_ = kTestEnd; |
483 } | 533 } |
484 break; | 534 break; |
485 } | 535 case kTestEnd: |
| 536 observation_complete_.Set(); |
| 537 break; |
| 538 case kTransitionToNextState: |
| 539 if (!ExpectingFec() || GetFecBytes() > 0) { |
| 540 test_state_ = next_state_; |
| 541 forward_transport_config_.link_capacity_kbps = link_rates_[test_state_]; |
| 542 // No loss while ramping up and down as it may affect the BWE |
| 543 // negatively, making the test flaky. |
| 544 forward_transport_config_.loss_percent = 0; |
| 545 state_start_ms_ = now; |
| 546 interval_start_ms_ = now; |
| 547 sent_bytes_ = 0; |
| 548 send_transport_->SetConfig(forward_transport_config_); |
| 549 } |
| 550 break; |
486 } | 551 } |
487 } | 552 } |
488 | 553 |
489 class RampUpTest : public test::CallTest { | 554 class RampUpTest : public test::CallTest { |
490 public: | 555 public: |
491 RampUpTest() {} | 556 RampUpTest() {} |
492 | 557 |
493 virtual ~RampUpTest() { | 558 virtual ~RampUpTest() { |
494 EXPECT_EQ(nullptr, video_send_stream_); | 559 EXPECT_EQ(nullptr, video_send_stream_); |
495 EXPECT_TRUE(video_receive_streams_.empty()); | 560 EXPECT_TRUE(video_receive_streams_.empty()); |
496 } | 561 } |
497 }; | 562 }; |
498 | 563 |
499 static const uint32_t kStartBitrateBps = 60000; | 564 static const uint32_t kStartBitrateBps = 60000; |
500 | 565 |
501 TEST_F(RampUpTest, UpDownUpAbsSendTimeSimulcastRedRtx) { | 566 TEST_F(RampUpTest, UpDownUpAbsSendTimeSimulcastRedRtx) { |
502 RampUpDownUpTester test(3, 0, kStartBitrateBps, RtpExtension::kAbsSendTimeUri, | 567 std::vector<int> loss_rates = {0, 0, 0, 0}; |
503 true, true); | 568 RampUpDownUpTester test(3, 0, 0, kStartBitrateBps, |
| 569 RtpExtension::kAbsSendTimeUri, true, true, |
| 570 loss_rates); |
504 RunBaseTest(&test); | 571 RunBaseTest(&test); |
505 } | 572 } |
506 | 573 |
507 TEST_F(RampUpTest, UpDownUpTransportSequenceNumberRtx) { | 574 TEST_F(RampUpTest, UpDownUpTransportSequenceNumberRtx) { |
508 RampUpDownUpTester test(3, 0, kStartBitrateBps, | 575 std::vector<int> loss_rates = {0, 0, 0, 0}; |
| 576 RampUpDownUpTester test(3, 0, 0, kStartBitrateBps, |
509 RtpExtension::kTransportSequenceNumberUri, true, | 577 RtpExtension::kTransportSequenceNumberUri, true, |
510 false); | 578 false, loss_rates); |
| 579 RunBaseTest(&test); |
| 580 } |
| 581 |
| 582 TEST_F(RampUpTest, UpDownUpTransportSequenceNumberPacketLoss) { |
| 583 std::vector<int> loss_rates = {20, 0, 0, 0}; |
| 584 RampUpDownUpTester test(1, 0, 1, kStartBitrateBps, |
| 585 RtpExtension::kTransportSequenceNumberUri, true, |
| 586 false, loss_rates); |
511 RunBaseTest(&test); | 587 RunBaseTest(&test); |
512 } | 588 } |
513 | 589 |
514 TEST_F(RampUpTest, UpDownUpAudioVideoTransportSequenceNumberRtx) { | 590 TEST_F(RampUpTest, UpDownUpAudioVideoTransportSequenceNumberRtx) { |
515 RampUpDownUpTester test(3, 1, kStartBitrateBps, | 591 std::vector<int> loss_rates = {0, 0, 0, 0}; |
| 592 RampUpDownUpTester test(3, 1, 0, kStartBitrateBps, |
516 RtpExtension::kTransportSequenceNumberUri, true, | 593 RtpExtension::kTransportSequenceNumberUri, true, |
517 false); | 594 false, loss_rates); |
518 RunBaseTest(&test); | 595 RunBaseTest(&test); |
519 } | 596 } |
520 | 597 |
521 TEST_F(RampUpTest, UpDownUpAudioTransportSequenceNumberRtx) { | 598 TEST_F(RampUpTest, UpDownUpAudioTransportSequenceNumberRtx) { |
522 RampUpDownUpTester test(0, 1, kStartBitrateBps, | 599 std::vector<int> loss_rates = {0, 0, 0, 0}; |
| 600 RampUpDownUpTester test(0, 1, 0, kStartBitrateBps, |
523 RtpExtension::kTransportSequenceNumberUri, true, | 601 RtpExtension::kTransportSequenceNumberUri, true, |
524 false); | 602 false, loss_rates); |
525 RunBaseTest(&test); | 603 RunBaseTest(&test); |
526 } | 604 } |
527 | 605 |
528 TEST_F(RampUpTest, TOffsetSimulcastRedRtx) { | 606 TEST_F(RampUpTest, TOffsetSimulcastRedRtx) { |
529 RampUpTester test(3, 0, 0, 0, RtpExtension::kTimestampOffsetUri, true, true, | 607 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kTimestampOffsetUri, true, |
530 true); | 608 true, true); |
531 RunBaseTest(&test); | 609 RunBaseTest(&test); |
532 } | 610 } |
533 | 611 |
534 TEST_F(RampUpTest, AbsSendTime) { | 612 TEST_F(RampUpTest, AbsSendTime) { |
535 RampUpTester test(1, 0, 0, 0, RtpExtension::kAbsSendTimeUri, false, false, | 613 RampUpTester test(1, 0, 0, 0, 0, RtpExtension::kAbsSendTimeUri, false, false, |
536 true); | 614 true); |
537 RunBaseTest(&test); | 615 RunBaseTest(&test); |
538 } | 616 } |
539 | 617 |
540 TEST_F(RampUpTest, AbsSendTimeSimulcastRedRtx) { | 618 TEST_F(RampUpTest, AbsSendTimeSimulcastRedRtx) { |
541 RampUpTester test(3, 0, 0, 0, RtpExtension::kAbsSendTimeUri, true, true, | 619 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kAbsSendTimeUri, true, true, |
542 true); | 620 true); |
543 RunBaseTest(&test); | 621 RunBaseTest(&test); |
544 } | 622 } |
545 | 623 |
546 TEST_F(RampUpTest, TransportSequenceNumber) { | 624 TEST_F(RampUpTest, TransportSequenceNumber) { |
547 RampUpTester test(1, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri, | 625 RampUpTester test(1, 0, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri, |
548 false, false, true); | 626 false, false, true); |
549 RunBaseTest(&test); | 627 RunBaseTest(&test); |
550 } | 628 } |
551 | 629 |
552 TEST_F(RampUpTest, TransportSequenceNumberSimulcast) { | 630 TEST_F(RampUpTest, TransportSequenceNumberSimulcast) { |
553 RampUpTester test(3, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri, | 631 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri, |
554 false, false, true); | 632 false, false, true); |
555 RunBaseTest(&test); | 633 RunBaseTest(&test); |
556 } | 634 } |
557 | 635 |
558 TEST_F(RampUpTest, TransportSequenceNumberSimulcastRedRtx) { | 636 TEST_F(RampUpTest, TransportSequenceNumberSimulcastRedRtx) { |
559 RampUpTester test(3, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri, | 637 RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri, |
560 true, true, true); | 638 true, true, true); |
561 RunBaseTest(&test); | 639 RunBaseTest(&test); |
562 } | 640 } |
563 | 641 |
564 TEST_F(RampUpTest, AudioTransportSequenceNumber) { | 642 TEST_F(RampUpTest, AudioTransportSequenceNumber) { |
565 RampUpTester test(0, 1, 300000, 10000, | 643 RampUpTester test(0, 1, 0, 300000, 10000, |
566 RtpExtension::kTransportSequenceNumberUri, false, false, | 644 RtpExtension::kTransportSequenceNumberUri, false, false, |
567 false); | 645 false); |
568 RunBaseTest(&test); | 646 RunBaseTest(&test); |
569 } | 647 } |
570 } // namespace webrtc | 648 } // namespace webrtc |
OLD | NEW |