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