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 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 call_config.bitrate_config.start_bitrate_bps = start_bitrate_bps_; | 80 call_config.bitrate_config.start_bitrate_bps = start_bitrate_bps_; |
81 } | 81 } |
82 call_config.bitrate_config.min_bitrate_bps = 10000; | 82 call_config.bitrate_config.min_bitrate_bps = 10000; |
83 return call_config; | 83 return call_config; |
84 } | 84 } |
85 | 85 |
86 void RampUpTester::OnStreamsCreated( | 86 void RampUpTester::OnStreamsCreated( |
87 VideoSendStream* send_stream, | 87 VideoSendStream* send_stream, |
88 const std::vector<VideoReceiveStream*>& receive_streams) { | 88 const std::vector<VideoReceiveStream*>& receive_streams) { |
89 send_stream_ = send_stream; | 89 send_stream_ = send_stream; |
| 90 send_transport_->SetConfig(forward_transport_config_); |
90 } | 91 } |
91 | 92 |
92 size_t RampUpTester::GetNumStreams() const { | 93 size_t RampUpTester::GetNumStreams() const { |
93 return num_streams_; | 94 return num_streams_; |
94 } | 95 } |
95 | 96 |
96 void RampUpTester::ModifyConfigs( | 97 void RampUpTester::ModifyConfigs( |
97 VideoSendStream::Config* send_config, | 98 VideoSendStream::Config* send_config, |
98 std::vector<VideoReceiveStream::Config>* receive_configs, | 99 std::vector<VideoReceiveStream::Config>* receive_configs, |
99 VideoEncoderConfig* encoder_config) { | 100 VideoEncoderConfig* encoder_config) { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 const std::string& extension_type, | 280 const std::string& extension_type, |
280 bool rtx, | 281 bool rtx, |
281 bool red) | 282 bool red) |
282 : RampUpTester(num_streams, start_bitrate_bps, extension_type, rtx, red), | 283 : RampUpTester(num_streams, start_bitrate_bps, extension_type, rtx, red), |
283 test_state_(kFirstRampup), | 284 test_state_(kFirstRampup), |
284 state_start_ms_(clock_->TimeInMilliseconds()), | 285 state_start_ms_(clock_->TimeInMilliseconds()), |
285 interval_start_ms_(clock_->TimeInMilliseconds()), | 286 interval_start_ms_(clock_->TimeInMilliseconds()), |
286 sent_bytes_(0) { | 287 sent_bytes_(0) { |
287 forward_transport_config_.link_capacity_kbps = | 288 forward_transport_config_.link_capacity_kbps = |
288 kHighBandwidthLimitBps / 1000; | 289 kHighBandwidthLimitBps / 1000; |
289 send_transport_.SetConfig(forward_transport_config_); | |
290 } | 290 } |
291 | 291 |
292 RampUpDownUpTester::~RampUpDownUpTester() {} | 292 RampUpDownUpTester::~RampUpDownUpTester() {} |
293 | 293 |
294 bool RampUpDownUpTester::PollStats() { | 294 bool RampUpDownUpTester::PollStats() { |
295 if (send_stream_) { | 295 if (send_stream_) { |
296 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats(); | 296 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats(); |
297 int transmit_bitrate_bps = 0; | 297 int transmit_bitrate_bps = 0; |
298 for (auto it : stats.substreams) { | 298 for (auto it : stats.substreams) { |
299 transmit_bitrate_bps += it.second.total_bitrate_bps; | 299 transmit_bitrate_bps += it.second.total_bitrate_bps; |
(...skipping 27 matching lines...) Expand all Loading... |
327 void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) { | 327 void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) { |
328 int64_t now = clock_->TimeInMilliseconds(); | 328 int64_t now = clock_->TimeInMilliseconds(); |
329 switch (test_state_) { | 329 switch (test_state_) { |
330 case kFirstRampup: { | 330 case kFirstRampup: { |
331 EXPECT_FALSE(suspended); | 331 EXPECT_FALSE(suspended); |
332 if (bitrate_bps > kExpectedHighBitrateBps) { | 332 if (bitrate_bps > kExpectedHighBitrateBps) { |
333 // The first ramp-up has reached the target bitrate. Change the | 333 // The first ramp-up has reached the target bitrate. Change the |
334 // channel limit, and move to the next test state. | 334 // channel limit, and move to the next test state. |
335 forward_transport_config_.link_capacity_kbps = | 335 forward_transport_config_.link_capacity_kbps = |
336 kLowBandwidthLimitBps / 1000; | 336 kLowBandwidthLimitBps / 1000; |
337 send_transport_.SetConfig(forward_transport_config_); | 337 send_transport_->SetConfig(forward_transport_config_); |
338 test_state_ = kLowRate; | 338 test_state_ = kLowRate; |
339 webrtc::test::PrintResult("ramp_up_down_up", | 339 webrtc::test::PrintResult("ramp_up_down_up", |
340 GetModifierString(), | 340 GetModifierString(), |
341 "first_rampup", | 341 "first_rampup", |
342 now - state_start_ms_, | 342 now - state_start_ms_, |
343 "ms", | 343 "ms", |
344 false); | 344 false); |
345 state_start_ms_ = now; | 345 state_start_ms_ = now; |
346 interval_start_ms_ = now; | 346 interval_start_ms_ = now; |
347 sent_bytes_ = 0; | 347 sent_bytes_ = 0; |
348 } | 348 } |
349 break; | 349 break; |
350 } | 350 } |
351 case kLowRate: { | 351 case kLowRate: { |
352 if (bitrate_bps < kExpectedLowBitrateBps && suspended) { | 352 if (bitrate_bps < kExpectedLowBitrateBps && suspended) { |
353 // The ramp-down was successful. Change the channel limit back to a | 353 // The ramp-down was successful. Change the channel limit back to a |
354 // high value, and move to the next test state. | 354 // high value, and move to the next test state. |
355 forward_transport_config_.link_capacity_kbps = | 355 forward_transport_config_.link_capacity_kbps = |
356 kHighBandwidthLimitBps / 1000; | 356 kHighBandwidthLimitBps / 1000; |
357 send_transport_.SetConfig(forward_transport_config_); | 357 send_transport_->SetConfig(forward_transport_config_); |
358 test_state_ = kSecondRampup; | 358 test_state_ = kSecondRampup; |
359 webrtc::test::PrintResult("ramp_up_down_up", | 359 webrtc::test::PrintResult("ramp_up_down_up", |
360 GetModifierString(), | 360 GetModifierString(), |
361 "rampdown", | 361 "rampdown", |
362 now - state_start_ms_, | 362 now - state_start_ms_, |
363 "ms", | 363 "ms", |
364 false); | 364 false); |
365 state_start_ms_ = now; | 365 state_start_ms_ = now; |
366 interval_start_ms_ = now; | 366 interval_start_ms_ = now; |
367 sent_bytes_ = 0; | 367 sent_bytes_ = 0; |
(...skipping 20 matching lines...) Expand all Loading... |
388 RampUpTest() {} | 388 RampUpTest() {} |
389 | 389 |
390 virtual ~RampUpTest() { | 390 virtual ~RampUpTest() { |
391 EXPECT_EQ(nullptr, send_stream_); | 391 EXPECT_EQ(nullptr, send_stream_); |
392 EXPECT_TRUE(receive_streams_.empty()); | 392 EXPECT_TRUE(receive_streams_.empty()); |
393 } | 393 } |
394 }; | 394 }; |
395 | 395 |
396 TEST_F(RampUpTest, SingleStream) { | 396 TEST_F(RampUpTest, SingleStream) { |
397 RampUpTester test(1, 0, RtpExtension::kTOffset, false, false); | 397 RampUpTester test(1, 0, RtpExtension::kTOffset, false, false); |
398 RunBaseTest(&test); | 398 RunBaseTest(&test, FakeNetworkPipe::Config()); |
399 } | 399 } |
400 | 400 |
401 TEST_F(RampUpTest, Simulcast) { | 401 TEST_F(RampUpTest, Simulcast) { |
402 RampUpTester test(3, 0, RtpExtension::kTOffset, false, false); | 402 RampUpTester test(3, 0, RtpExtension::kTOffset, false, false); |
403 RunBaseTest(&test); | 403 RunBaseTest(&test, FakeNetworkPipe::Config()); |
404 } | 404 } |
405 | 405 |
406 TEST_F(RampUpTest, SimulcastWithRtx) { | 406 TEST_F(RampUpTest, SimulcastWithRtx) { |
407 RampUpTester test(3, 0, RtpExtension::kTOffset, true, false); | 407 RampUpTester test(3, 0, RtpExtension::kTOffset, true, false); |
408 RunBaseTest(&test); | 408 RunBaseTest(&test, FakeNetworkPipe::Config()); |
409 } | 409 } |
410 | 410 |
411 TEST_F(RampUpTest, SimulcastByRedWithRtx) { | 411 TEST_F(RampUpTest, SimulcastByRedWithRtx) { |
412 RampUpTester test(3, 0, RtpExtension::kTOffset, true, true); | 412 RampUpTester test(3, 0, RtpExtension::kTOffset, true, true); |
413 RunBaseTest(&test); | 413 RunBaseTest(&test, FakeNetworkPipe::Config()); |
414 } | 414 } |
415 | 415 |
416 TEST_F(RampUpTest, SingleStreamWithHighStartBitrate) { | 416 TEST_F(RampUpTest, SingleStreamWithHighStartBitrate) { |
417 RampUpTester test(1, 0.9 * kSingleStreamTargetBps, RtpExtension::kTOffset, | 417 RampUpTester test(1, 0.9 * kSingleStreamTargetBps, RtpExtension::kTOffset, |
418 false, false); | 418 false, false); |
419 RunBaseTest(&test); | 419 RunBaseTest(&test, FakeNetworkPipe::Config()); |
420 } | 420 } |
421 | 421 |
422 TEST_F(RampUpTest, UpDownUpOneStream) { | 422 TEST_F(RampUpTest, UpDownUpOneStream) { |
423 RampUpDownUpTester test(1, 60000, RtpExtension::kAbsSendTime, false, false); | 423 RampUpDownUpTester test(1, 60000, RtpExtension::kAbsSendTime, false, false); |
424 RunBaseTest(&test); | 424 RunBaseTest(&test, FakeNetworkPipe::Config()); |
425 } | 425 } |
426 | 426 |
427 TEST_F(RampUpTest, UpDownUpThreeStreams) { | 427 TEST_F(RampUpTest, UpDownUpThreeStreams) { |
428 RampUpDownUpTester test(3, 60000, RtpExtension::kAbsSendTime, false, false); | 428 RampUpDownUpTester test(3, 60000, RtpExtension::kAbsSendTime, false, false); |
429 RunBaseTest(&test); | 429 RunBaseTest(&test, FakeNetworkPipe::Config()); |
430 } | 430 } |
431 | 431 |
432 TEST_F(RampUpTest, UpDownUpOneStreamRtx) { | 432 TEST_F(RampUpTest, UpDownUpOneStreamRtx) { |
433 RampUpDownUpTester test(1, 60000, RtpExtension::kAbsSendTime, true, false); | 433 RampUpDownUpTester test(1, 60000, RtpExtension::kAbsSendTime, true, false); |
434 RunBaseTest(&test); | 434 RunBaseTest(&test, FakeNetworkPipe::Config()); |
435 } | 435 } |
436 | 436 |
437 TEST_F(RampUpTest, UpDownUpThreeStreamsRtx) { | 437 TEST_F(RampUpTest, UpDownUpThreeStreamsRtx) { |
438 RampUpDownUpTester test(3, 60000, RtpExtension::kAbsSendTime, true, false); | 438 RampUpDownUpTester test(3, 60000, RtpExtension::kAbsSendTime, true, false); |
439 RunBaseTest(&test); | 439 RunBaseTest(&test, FakeNetworkPipe::Config()); |
440 } | 440 } |
441 | 441 |
442 TEST_F(RampUpTest, UpDownUpOneStreamByRedRtx) { | 442 TEST_F(RampUpTest, UpDownUpOneStreamByRedRtx) { |
443 RampUpDownUpTester test(1, 60000, RtpExtension::kAbsSendTime, true, true); | 443 RampUpDownUpTester test(1, 60000, RtpExtension::kAbsSendTime, true, true); |
444 RunBaseTest(&test); | 444 RunBaseTest(&test, FakeNetworkPipe::Config()); |
445 } | 445 } |
446 | 446 |
447 TEST_F(RampUpTest, UpDownUpThreeStreamsByRedRtx) { | 447 TEST_F(RampUpTest, UpDownUpThreeStreamsByRedRtx) { |
448 RampUpDownUpTester test(3, 60000, RtpExtension::kAbsSendTime, true, true); | 448 RampUpDownUpTester test(3, 60000, RtpExtension::kAbsSendTime, true, true); |
449 RunBaseTest(&test); | 449 RunBaseTest(&test, FakeNetworkPipe::Config()); |
450 } | 450 } |
451 | 451 |
452 TEST_F(RampUpTest, AbsSendTimeSingleStream) { | 452 TEST_F(RampUpTest, AbsSendTimeSingleStream) { |
453 RampUpTester test(1, 0, RtpExtension::kAbsSendTime, false, false); | 453 RampUpTester test(1, 0, RtpExtension::kAbsSendTime, false, false); |
454 RunBaseTest(&test); | 454 RunBaseTest(&test, FakeNetworkPipe::Config()); |
455 } | 455 } |
456 | 456 |
457 TEST_F(RampUpTest, AbsSendTimeSimulcast) { | 457 TEST_F(RampUpTest, AbsSendTimeSimulcast) { |
458 RampUpTester test(3, 0, RtpExtension::kAbsSendTime, false, false); | 458 RampUpTester test(3, 0, RtpExtension::kAbsSendTime, false, false); |
459 RunBaseTest(&test); | 459 RunBaseTest(&test, FakeNetworkPipe::Config()); |
460 } | 460 } |
461 | 461 |
462 TEST_F(RampUpTest, AbsSendTimeSimulcastWithRtx) { | 462 TEST_F(RampUpTest, AbsSendTimeSimulcastWithRtx) { |
463 RampUpTester test(3, 0, RtpExtension::kAbsSendTime, true, false); | 463 RampUpTester test(3, 0, RtpExtension::kAbsSendTime, true, false); |
464 RunBaseTest(&test); | 464 RunBaseTest(&test, FakeNetworkPipe::Config()); |
465 } | 465 } |
466 | 466 |
467 TEST_F(RampUpTest, AbsSendTimeSimulcastByRedWithRtx) { | 467 TEST_F(RampUpTest, AbsSendTimeSimulcastByRedWithRtx) { |
468 RampUpTester test(3, 0, RtpExtension::kAbsSendTime, true, true); | 468 RampUpTester test(3, 0, RtpExtension::kAbsSendTime, true, true); |
469 RunBaseTest(&test); | 469 RunBaseTest(&test, FakeNetworkPipe::Config()); |
470 } | 470 } |
471 | 471 |
472 TEST_F(RampUpTest, AbsSendTimeSingleStreamWithHighStartBitrate) { | 472 TEST_F(RampUpTest, AbsSendTimeSingleStreamWithHighStartBitrate) { |
473 RampUpTester test(1, 0.9 * kSingleStreamTargetBps, RtpExtension::kAbsSendTime, | 473 RampUpTester test(1, 0.9 * kSingleStreamTargetBps, RtpExtension::kAbsSendTime, |
474 false, false); | 474 false, false); |
475 RunBaseTest(&test); | 475 RunBaseTest(&test, FakeNetworkPipe::Config()); |
476 } | 476 } |
477 | 477 |
478 TEST_F(RampUpTest, TransportSequenceNumberSingleStream) { | 478 TEST_F(RampUpTest, TransportSequenceNumberSingleStream) { |
479 RampUpTester test(1, 0, RtpExtension::kTransportSequenceNumber, false, false); | 479 RampUpTester test(1, 0, RtpExtension::kTransportSequenceNumber, false, false); |
480 RunBaseTest(&test); | 480 RunBaseTest(&test, FakeNetworkPipe::Config()); |
481 } | 481 } |
482 | 482 |
483 TEST_F(RampUpTest, TransportSequenceNumberSimulcast) { | 483 TEST_F(RampUpTest, TransportSequenceNumberSimulcast) { |
484 RampUpTester test(3, 0, RtpExtension::kTransportSequenceNumber, false, false); | 484 RampUpTester test(3, 0, RtpExtension::kTransportSequenceNumber, false, false); |
485 RunBaseTest(&test); | 485 RunBaseTest(&test, FakeNetworkPipe::Config()); |
486 } | 486 } |
487 | 487 |
488 TEST_F(RampUpTest, TransportSequenceNumberSimulcastWithRtx) { | 488 TEST_F(RampUpTest, TransportSequenceNumberSimulcastWithRtx) { |
489 RampUpTester test(3, 0, RtpExtension::kTransportSequenceNumber, true, false); | 489 RampUpTester test(3, 0, RtpExtension::kTransportSequenceNumber, true, false); |
490 RunBaseTest(&test); | 490 RunBaseTest(&test, FakeNetworkPipe::Config()); |
491 } | 491 } |
492 | 492 |
493 TEST_F(RampUpTest, TransportSequenceNumberSimulcastByRedWithRtx) { | 493 TEST_F(RampUpTest, TransportSequenceNumberSimulcastByRedWithRtx) { |
494 RampUpTester test(3, 0, RtpExtension::kTransportSequenceNumber, true, true); | 494 RampUpTester test(3, 0, RtpExtension::kTransportSequenceNumber, true, true); |
495 RunBaseTest(&test); | 495 RunBaseTest(&test, FakeNetworkPipe::Config()); |
496 } | 496 } |
497 | 497 |
498 TEST_F(RampUpTest, TransportSequenceNumberSingleStreamWithHighStartBitrate) { | 498 TEST_F(RampUpTest, TransportSequenceNumberSingleStreamWithHighStartBitrate) { |
499 RampUpTester test(1, 0.9 * kSingleStreamTargetBps, | 499 RampUpTester test(1, 0.9 * kSingleStreamTargetBps, |
500 RtpExtension::kTransportSequenceNumber, false, false); | 500 RtpExtension::kTransportSequenceNumber, false, false); |
501 RunBaseTest(&test); | 501 RunBaseTest(&test, FakeNetworkPipe::Config()); |
502 } | 502 } |
503 } // namespace webrtc | 503 } // namespace webrtc |
OLD | NEW |