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

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

Issue 2304363002: Let ViEEncoder express resolution requests as Sinkwants (Closed)
Patch Set: Revert changes to OveruseFrameDetector. Fix merge mistake Created 4 years, 1 month 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 }; 56 };
57 enum class CreateOrder { 57 enum class CreateOrder {
58 kAudioFirst, kVideoFirst 58 kAudioFirst, kVideoFirst
59 }; 59 };
60 void TestAudioVideoSync(FecMode fec, 60 void TestAudioVideoSync(FecMode fec,
61 CreateOrder create_first, 61 CreateOrder create_first,
62 float video_ntp_speed, 62 float video_ntp_speed,
63 float video_rtp_speed, 63 float video_rtp_speed,
64 float audio_rtp_speed); 64 float audio_rtp_speed);
65 65
66 void TestCpuOveruse(LoadObserver::Load tested_load, int encode_delay_ms);
67
68 void TestMinTransmitBitrate(bool pad_to_min_bitrate); 66 void TestMinTransmitBitrate(bool pad_to_min_bitrate);
69 67
70 void TestCaptureNtpTime(const FakeNetworkPipe::Config& net_config, 68 void TestCaptureNtpTime(const FakeNetworkPipe::Config& net_config,
71 int threshold_ms, 69 int threshold_ms,
72 int start_time_ms, 70 int start_time_ms,
73 int run_time_ms); 71 int run_time_ms);
74 }; 72 };
75 73
76 class VideoRtcpAndSyncObserver : public test::RtpRtcpObserver, 74 class VideoRtcpAndSyncObserver : public test::RtpRtcpObserver,
77 public rtc::VideoSinkInterface<VideoFrame> { 75 public rtc::VideoSinkInterface<VideoFrame> {
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 net_config.queue_delay_ms = 100; 472 net_config.queue_delay_ms = 100;
475 net_config.delay_standard_deviation_ms = 10; 473 net_config.delay_standard_deviation_ms = 10;
476 // TODO(wu): lower the threshold as the calculation/estimatation becomes more 474 // TODO(wu): lower the threshold as the calculation/estimatation becomes more
477 // accurate. 475 // accurate.
478 const int kThresholdMs = 100; 476 const int kThresholdMs = 100;
479 const int kStartTimeMs = 10000; 477 const int kStartTimeMs = 10000;
480 const int kRunTimeMs = 20000; 478 const int kRunTimeMs = 20000;
481 TestCaptureNtpTime(net_config, kThresholdMs, kStartTimeMs, kRunTimeMs); 479 TestCaptureNtpTime(net_config, kThresholdMs, kStartTimeMs, kRunTimeMs);
482 } 480 }
483 481
484 void CallPerfTest::TestCpuOveruse(LoadObserver::Load tested_load, 482 TEST_F(CallPerfTest, ReceivesCpuOveruseAndUnderuse) {
485 int encode_delay_ms) { 483 class LoadObserver : public test::SendTest,
486 class LoadObserver : public test::SendTest, public webrtc::LoadObserver { 484 public test::FrameGeneratorCapturer::SinkWantsObserver {
487 public: 485 public:
488 LoadObserver(LoadObserver::Load tested_load, int encode_delay_ms) 486 LoadObserver()
489 : SendTest(kLongTimeoutMs), 487 : SendTest(kLongTimeoutMs),
490 tested_load_(tested_load), 488 expect_lower_resolution_wants_(true),
491 encoder_(Clock::GetRealTimeClock(), encode_delay_ms) {} 489 encoder_(Clock::GetRealTimeClock(), 35 /* delay_ms */) {}
492 490
493 void OnLoadUpdate(Load load) override { 491 void OnFrameGeneratorCapturerCreated(
494 if (load == tested_load_) 492 test::FrameGeneratorCapturer* frame_generator_capturer) override {
493 frame_generator_capturer->SetSinkWantsObserver(this);
494 }
495
496 // OnSinkWantsChanged is called when FrameGeneratorCapturer::AddOrUpdateSink
497 // is called.
498 void OnSinkWantsChanged(rtc::VideoSinkInterface<VideoFrame>* sink,
499 const rtc::VideoSinkWants& wants) override {
500 // First expect CPU overuse. Then expect CPU underuse when the encoder
501 // delay has been decreased.
502 if (wants.max_pixel_count) {
503 EXPECT_TRUE(expect_lower_resolution_wants_);
504 expect_lower_resolution_wants_ = false;
505 encoder_.SetDelay(2);
506 } else if (wants.max_pixel_count_step_up) {
507 EXPECT_FALSE(expect_lower_resolution_wants_);
495 observation_complete_.Set(); 508 observation_complete_.Set();
509 }
496 } 510 }
497 511
498 void ModifyVideoConfigs( 512 void ModifyVideoConfigs(
499 VideoSendStream::Config* send_config, 513 VideoSendStream::Config* send_config,
500 std::vector<VideoReceiveStream::Config>* receive_configs, 514 std::vector<VideoReceiveStream::Config>* receive_configs,
501 VideoEncoderConfig* encoder_config) override { 515 VideoEncoderConfig* encoder_config) override {
502 send_config->overuse_callback = this;
503 send_config->encoder_settings.encoder = &encoder_; 516 send_config->encoder_settings.encoder = &encoder_;
504 } 517 }
505 518
506 void PerformTest() override { 519 void PerformTest() override {
507 EXPECT_TRUE(Wait()) << "Timed out before receiving an overuse callback."; 520 EXPECT_TRUE(Wait()) << "Timed out before receiving an overuse callback.";
508 } 521 }
509 522
510 LoadObserver::Load tested_load_; 523 bool expect_lower_resolution_wants_;
511 test::DelayedEncoder encoder_; 524 test::DelayedEncoder encoder_;
512 } test(tested_load, encode_delay_ms); 525 } test;
513 526
514 RunBaseTest(&test); 527 RunBaseTest(&test);
515 } 528 }
516 529
517 TEST_F(CallPerfTest, ReceivesCpuUnderuse) {
518 const int kEncodeDelayMs = 2;
519 TestCpuOveruse(LoadObserver::kUnderuse, kEncodeDelayMs);
520 }
521
522 TEST_F(CallPerfTest, ReceivesCpuOveruse) {
523 const int kEncodeDelayMs = 35;
524 TestCpuOveruse(LoadObserver::kOveruse, kEncodeDelayMs);
525 }
526
527 void CallPerfTest::TestMinTransmitBitrate(bool pad_to_min_bitrate) { 530 void CallPerfTest::TestMinTransmitBitrate(bool pad_to_min_bitrate) {
528 static const int kMaxEncodeBitrateKbps = 30; 531 static const int kMaxEncodeBitrateKbps = 30;
529 static const int kMinTransmitBitrateBps = 150000; 532 static const int kMinTransmitBitrateBps = 150000;
530 static const int kMinAcceptableTransmitBitrate = 130; 533 static const int kMinAcceptableTransmitBitrate = 130;
531 static const int kMaxAcceptableTransmitBitrate = 170; 534 static const int kMaxAcceptableTransmitBitrate = 170;
532 static const int kNumBitrateObservationsInRange = 100; 535 static const int kNumBitrateObservationsInRange = 100;
533 static const int kAcceptableBitrateErrorMargin = 15; // +- 7 536 static const int kAcceptableBitrateErrorMargin = 15; // +- 7
534 class BitrateObserver : public test::EndToEndTest { 537 class BitrateObserver : public test::EndToEndTest {
535 public: 538 public:
536 explicit BitrateObserver(bool using_min_transmit_bitrate) 539 explicit BitrateObserver(bool using_min_transmit_bitrate)
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 uint32_t last_set_bitrate_; 732 uint32_t last_set_bitrate_;
730 VideoSendStream* send_stream_; 733 VideoSendStream* send_stream_;
731 test::FrameGeneratorCapturer* frame_generator_; 734 test::FrameGeneratorCapturer* frame_generator_;
732 VideoEncoderConfig encoder_config_; 735 VideoEncoderConfig encoder_config_;
733 } test; 736 } test;
734 737
735 RunBaseTest(&test); 738 RunBaseTest(&test);
736 } 739 }
737 740
738 } // namespace webrtc 741 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698