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