Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: webrtc/call/call_perf_tests.cc

Issue 2304363002: Let ViEEncoder express resolution requests as Sinkwants (Closed)
Patch Set: Rebased and fixed. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 }; 55 };
56 enum class CreateOrder { 56 enum class CreateOrder {
57 kAudioFirst, kVideoFirst 57 kAudioFirst, kVideoFirst
58 }; 58 };
59 void TestAudioVideoSync(FecMode fec, 59 void TestAudioVideoSync(FecMode fec,
60 CreateOrder create_first, 60 CreateOrder create_first,
61 float video_ntp_speed, 61 float video_ntp_speed,
62 float video_rtp_speed, 62 float video_rtp_speed,
63 float audio_rtp_speed); 63 float audio_rtp_speed);
64 64
65 void TestCpuOveruse(LoadObserver::Load tested_load, int encode_delay_ms); 65 void TestCpuOveruse(bool expect_lower_resolution_wants, int encode_delay_ms);
66 66
67 void TestMinTransmitBitrate(bool pad_to_min_bitrate); 67 void TestMinTransmitBitrate(bool pad_to_min_bitrate);
68 68
69 void TestCaptureNtpTime(const FakeNetworkPipe::Config& net_config, 69 void TestCaptureNtpTime(const FakeNetworkPipe::Config& net_config,
70 int threshold_ms, 70 int threshold_ms,
71 int start_time_ms, 71 int start_time_ms,
72 int run_time_ms); 72 int run_time_ms);
73 }; 73 };
74 74
75 class VideoRtcpAndSyncObserver : public test::RtpRtcpObserver, 75 class VideoRtcpAndSyncObserver : public test::RtpRtcpObserver,
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 net_config.queue_delay_ms = 100; 472 net_config.queue_delay_ms = 100;
473 net_config.delay_standard_deviation_ms = 10; 473 net_config.delay_standard_deviation_ms = 10;
474 // TODO(wu): lower the threshold as the calculation/estimatation becomes more 474 // TODO(wu): lower the threshold as the calculation/estimatation becomes more
475 // accurate. 475 // accurate.
476 const int kThresholdMs = 100; 476 const int kThresholdMs = 100;
477 const int kStartTimeMs = 10000; 477 const int kStartTimeMs = 10000;
478 const int kRunTimeMs = 20000; 478 const int kRunTimeMs = 20000;
479 TestCaptureNtpTime(net_config, kThresholdMs, kStartTimeMs, kRunTimeMs); 479 TestCaptureNtpTime(net_config, kThresholdMs, kStartTimeMs, kRunTimeMs);
480 } 480 }
481 481
482 void CallPerfTest::TestCpuOveruse(LoadObserver::Load tested_load, 482 void CallPerfTest::TestCpuOveruse(bool expect_lower_resolution_wants,
483 int encode_delay_ms) { 483 int encode_delay_ms) {
484 class LoadObserver : public test::SendTest, public webrtc::LoadObserver { 484 class LoadObserver : public test::SendTest,
485 public test::FrameGeneratorCapturer::SinkWantsObserver {
485 public: 486 public:
486 LoadObserver(LoadObserver::Load tested_load, int encode_delay_ms) 487 LoadObserver(bool expect_lower_resolution_wants, int encode_delay_ms)
487 : SendTest(kLongTimeoutMs), 488 : SendTest(kLongTimeoutMs),
488 tested_load_(tested_load), 489 expect_lower_resolution_wants_(expect_lower_resolution_wants),
489 encoder_(Clock::GetRealTimeClock(), encode_delay_ms) {} 490 encoder_(Clock::GetRealTimeClock(), encode_delay_ms) {}
490 491
491 void OnLoadUpdate(Load load) override { 492 void OnFrameGeneratorCapturerCreated(
492 if (load == tested_load_) 493 test::FrameGeneratorCapturer* frame_generator_capturer) override {
493 observation_complete_.Set(); 494 frame_generator_capturer->SetSinkWantsObserver(this);
495 }
496
497 // OnSinkWantsChanged is called when FrameGeneratorCapturer::AddOrUpdateSink
498 // is called.
499 void OnSinkWantsChanged(rtc::VideoSinkInterface<VideoFrame>* sink,
500 const rtc::VideoSinkWants& wants) override {
501 if (expect_lower_resolution_wants_) {
502 if (wants.max_pixel_count) {
503 observation_complete_.Set();
504 }
505 } else {
506 if (wants.max_pixel_count_step_up) {
507 observation_complete_.Set();
508 }
509 }
494 } 510 }
495 511
496 void ModifyVideoConfigs( 512 void ModifyVideoConfigs(
497 VideoSendStream::Config* send_config, 513 VideoSendStream::Config* send_config,
498 std::vector<VideoReceiveStream::Config>* receive_configs, 514 std::vector<VideoReceiveStream::Config>* receive_configs,
499 VideoEncoderConfig* encoder_config) override { 515 VideoEncoderConfig* encoder_config) override {
500 send_config->overuse_callback = this;
501 send_config->encoder_settings.encoder = &encoder_; 516 send_config->encoder_settings.encoder = &encoder_;
502 } 517 }
503 518
504 void PerformTest() override { 519 void PerformTest() override {
505 EXPECT_TRUE(Wait()) << "Timed out before receiving an overuse callback."; 520 EXPECT_TRUE(Wait()) << "Timed out before receiving an overuse callback.";
506 } 521 }
507 522
508 LoadObserver::Load tested_load_; 523 bool expect_lower_resolution_wants_;
509 test::DelayedEncoder encoder_; 524 test::DelayedEncoder encoder_;
510 } test(tested_load, encode_delay_ms); 525 } test(expect_lower_resolution_wants, encode_delay_ms);
511 526
512 RunBaseTest(&test); 527 RunBaseTest(&test);
513 } 528 }
514 529
515 TEST_F(CallPerfTest, ReceivesCpuUnderuse) { 530 TEST_F(CallPerfTest, ReceivesCpuUnderuse) {
516 const int kEncodeDelayMs = 2; 531 const int kEncodeDelayMs = 2;
517 TestCpuOveruse(LoadObserver::kUnderuse, kEncodeDelayMs); 532 TestCpuOveruse(false, kEncodeDelayMs);
518 } 533 }
519 534
520 TEST_F(CallPerfTest, ReceivesCpuOveruse) { 535 TEST_F(CallPerfTest, ReceivesCpuOveruse) {
521 const int kEncodeDelayMs = 35; 536 const int kEncodeDelayMs = 35;
522 TestCpuOveruse(LoadObserver::kOveruse, kEncodeDelayMs); 537 TestCpuOveruse(true, kEncodeDelayMs);
523 } 538 }
524 539
525 void CallPerfTest::TestMinTransmitBitrate(bool pad_to_min_bitrate) { 540 void CallPerfTest::TestMinTransmitBitrate(bool pad_to_min_bitrate) {
526 static const int kMaxEncodeBitrateKbps = 30; 541 static const int kMaxEncodeBitrateKbps = 30;
527 static const int kMinTransmitBitrateBps = 150000; 542 static const int kMinTransmitBitrateBps = 150000;
528 static const int kMinAcceptableTransmitBitrate = 130; 543 static const int kMinAcceptableTransmitBitrate = 130;
529 static const int kMaxAcceptableTransmitBitrate = 170; 544 static const int kMaxAcceptableTransmitBitrate = 170;
530 static const int kNumBitrateObservationsInRange = 100; 545 static const int kNumBitrateObservationsInRange = 100;
531 static const int kAcceptableBitrateErrorMargin = 15; // +- 7 546 static const int kAcceptableBitrateErrorMargin = 15; // +- 7
532 class BitrateObserver : public test::EndToEndTest { 547 class BitrateObserver : public test::EndToEndTest {
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 uint32_t last_set_bitrate_; 741 uint32_t last_set_bitrate_;
727 VideoSendStream* send_stream_; 742 VideoSendStream* send_stream_;
728 test::FrameGeneratorCapturer* frame_generator_; 743 test::FrameGeneratorCapturer* frame_generator_;
729 VideoEncoderConfig encoder_config_; 744 VideoEncoderConfig encoder_config_;
730 } test; 745 } test;
731 746
732 RunBaseTest(&test); 747 RunBaseTest(&test);
733 } 748 }
734 749
735 } // namespace webrtc 750 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698