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

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

Issue 2491393002: Revert of Issue 2434073003: Extract bitrate allocation ... (Closed)
Patch Set: 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
« no previous file with comments | « webrtc/api/android/jni/androidmediaencoder_jni.cc ('k') | webrtc/common_types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 } 633 }
634 }; 634 };
635 635
636 class BitrateObserver : public test::EndToEndTest, public test::FakeEncoder { 636 class BitrateObserver : public test::EndToEndTest, public test::FakeEncoder {
637 public: 637 public:
638 BitrateObserver() 638 BitrateObserver()
639 : EndToEndTest(kDefaultTimeoutMs), 639 : EndToEndTest(kDefaultTimeoutMs),
640 FakeEncoder(Clock::GetRealTimeClock()), 640 FakeEncoder(Clock::GetRealTimeClock()),
641 time_to_reconfigure_(false, false), 641 time_to_reconfigure_(false, false),
642 encoder_inits_(0), 642 encoder_inits_(0),
643 last_set_bitrate_kbps_(0), 643 last_set_bitrate_(0),
644 send_stream_(nullptr), 644 send_stream_(nullptr) {}
645 frame_generator_(nullptr) {}
646 645
647 int32_t InitEncode(const VideoCodec* config, 646 int32_t InitEncode(const VideoCodec* config,
648 int32_t number_of_cores, 647 int32_t number_of_cores,
649 size_t max_payload_size) override { 648 size_t max_payload_size) override {
650 ++encoder_inits_; 649 ++encoder_inits_;
651 if (encoder_inits_ == 1) { 650 if (encoder_inits_ == 1) {
652 // First time initialization. Frame size is known. 651 // First time initialization. Frame size is known.
653 // |expected_bitrate| is affected by bandwidth estimation before the 652 // |expected_bitrate| is affected by bandwidth estimation before the
654 // first frame arrives to the encoder. 653 // first frame arrives to the encoder.
655 uint32_t expected_bitrate = last_set_bitrate_kbps_ > 0 654 uint32_t expected_bitrate =
656 ? last_set_bitrate_kbps_ 655 last_set_bitrate_ > 0 ? last_set_bitrate_ : kInitialBitrateKbps;
657 : kInitialBitrateKbps;
658 EXPECT_EQ(expected_bitrate, config->startBitrate) 656 EXPECT_EQ(expected_bitrate, config->startBitrate)
659 << "Encoder not initialized at expected bitrate."; 657 << "Encoder not initialized at expected bitrate.";
660 EXPECT_EQ(kDefaultWidth, config->width); 658 EXPECT_EQ(kDefaultWidth, config->width);
661 EXPECT_EQ(kDefaultHeight, config->height); 659 EXPECT_EQ(kDefaultHeight, config->height);
662 } else if (encoder_inits_ == 2) { 660 } else if (encoder_inits_ == 2) {
663 EXPECT_EQ(2 * kDefaultWidth, config->width); 661 EXPECT_EQ(2 * kDefaultWidth, config->width);
664 EXPECT_EQ(2 * kDefaultHeight, config->height); 662 EXPECT_EQ(2 * kDefaultHeight, config->height);
665 EXPECT_GE(last_set_bitrate_kbps_, kReconfigureThresholdKbps); 663 EXPECT_GE(last_set_bitrate_, kReconfigureThresholdKbps);
666 EXPECT_NEAR(config->startBitrate, last_set_bitrate_kbps_, 664 EXPECT_NEAR(config->startBitrate,
665 last_set_bitrate_,
667 kPermittedReconfiguredBitrateDiffKbps) 666 kPermittedReconfiguredBitrateDiffKbps)
668 << "Encoder reconfigured with bitrate too far away from last set."; 667 << "Encoder reconfigured with bitrate too far away from last set.";
669 observation_complete_.Set(); 668 observation_complete_.Set();
670 } 669 }
671 return FakeEncoder::InitEncode(config, number_of_cores, max_payload_size); 670 return FakeEncoder::InitEncode(config, number_of_cores, max_payload_size);
672 } 671 }
673 672
674 int32_t SetRateAllocation(const BitrateAllocation& rate_allocation, 673 int32_t SetRates(uint32_t new_target_bitrate_kbps,
675 uint32_t framerate) override { 674 uint32_t framerate) override {
676 last_set_bitrate_kbps_ = rate_allocation.get_sum_kbps(); 675 last_set_bitrate_ = new_target_bitrate_kbps;
677 if (encoder_inits_ == 1 && 676 if (encoder_inits_ == 1 &&
678 rate_allocation.get_sum_kbps() > kReconfigureThresholdKbps) { 677 new_target_bitrate_kbps > kReconfigureThresholdKbps) {
679 time_to_reconfigure_.Set(); 678 time_to_reconfigure_.Set();
680 } 679 }
681 return FakeEncoder::SetRateAllocation(rate_allocation, framerate); 680 return FakeEncoder::SetRates(new_target_bitrate_kbps, framerate);
682 } 681 }
683 682
684 Call::Config GetSenderCallConfig() override { 683 Call::Config GetSenderCallConfig() override {
685 Call::Config config = EndToEndTest::GetSenderCallConfig(); 684 Call::Config config = EndToEndTest::GetSenderCallConfig();
686 config.event_log = &event_log_; 685 config.event_log = &event_log_;
687 config.bitrate_config.start_bitrate_bps = kInitialBitrateKbps * 1000; 686 config.bitrate_config.start_bitrate_bps = kInitialBitrateKbps * 1000;
688 return config; 687 return config;
689 } 688 }
690 689
691 void ModifyVideoConfigs( 690 void ModifyVideoConfigs(
(...skipping 25 matching lines...) Expand all
717 frame_generator_->ChangeResolution(kDefaultWidth * 2, kDefaultHeight * 2); 716 frame_generator_->ChangeResolution(kDefaultWidth * 2, kDefaultHeight * 2);
718 send_stream_->ReconfigureVideoEncoder(encoder_config_.Copy()); 717 send_stream_->ReconfigureVideoEncoder(encoder_config_.Copy());
719 EXPECT_TRUE(Wait()) 718 EXPECT_TRUE(Wait())
720 << "Timed out while waiting for a couple of high bitrate estimates " 719 << "Timed out while waiting for a couple of high bitrate estimates "
721 "after reconfiguring the send stream."; 720 "after reconfiguring the send stream.";
722 } 721 }
723 722
724 private: 723 private:
725 rtc::Event time_to_reconfigure_; 724 rtc::Event time_to_reconfigure_;
726 int encoder_inits_; 725 int encoder_inits_;
727 uint32_t last_set_bitrate_kbps_; 726 uint32_t last_set_bitrate_;
728 VideoSendStream* send_stream_; 727 VideoSendStream* send_stream_;
729 test::FrameGeneratorCapturer* frame_generator_; 728 test::FrameGeneratorCapturer* frame_generator_;
730 VideoEncoderConfig encoder_config_; 729 VideoEncoderConfig encoder_config_;
731 } test; 730 } test;
732 731
733 RunBaseTest(&test); 732 RunBaseTest(&test);
734 } 733 }
735 734
736 } // namespace webrtc 735 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/android/jni/androidmediaencoder_jni.cc ('k') | webrtc/common_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698