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

Unified Diff: webrtc/call/call_perf_tests.cc

Issue 2510583002: Reland #2 of Issue 2434073003: Extract bitrate allocation ... (Closed)
Patch Set: Addressed comments 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/call/call_perf_tests.cc
diff --git a/webrtc/call/call_perf_tests.cc b/webrtc/call/call_perf_tests.cc
index ed1eb091b5b0e570993784cb86a7a78a50dff9d4..b09d73c42458c5d7476fce82be862c6340268938 100644
--- a/webrtc/call/call_perf_tests.cc
+++ b/webrtc/call/call_perf_tests.cc
@@ -640,8 +640,9 @@ TEST_F(CallPerfTest, KeepsHighBitrateWhenReconfiguringSender) {
FakeEncoder(Clock::GetRealTimeClock()),
time_to_reconfigure_(false, false),
encoder_inits_(0),
- last_set_bitrate_(0),
- send_stream_(nullptr) {}
+ last_set_bitrate_kbps_(0),
+ send_stream_(nullptr),
+ frame_generator_(nullptr) {}
int32_t InitEncode(const VideoCodec* config,
int32_t number_of_cores,
@@ -651,8 +652,9 @@ TEST_F(CallPerfTest, KeepsHighBitrateWhenReconfiguringSender) {
// First time initialization. Frame size is known.
// |expected_bitrate| is affected by bandwidth estimation before the
// first frame arrives to the encoder.
- uint32_t expected_bitrate =
- last_set_bitrate_ > 0 ? last_set_bitrate_ : kInitialBitrateKbps;
+ uint32_t expected_bitrate = last_set_bitrate_kbps_ > 0
+ ? last_set_bitrate_kbps_
+ : kInitialBitrateKbps;
EXPECT_EQ(expected_bitrate, config->startBitrate)
<< "Encoder not initialized at expected bitrate.";
EXPECT_EQ(kDefaultWidth, config->width);
@@ -660,9 +662,8 @@ TEST_F(CallPerfTest, KeepsHighBitrateWhenReconfiguringSender) {
} else if (encoder_inits_ == 2) {
EXPECT_EQ(2 * kDefaultWidth, config->width);
EXPECT_EQ(2 * kDefaultHeight, config->height);
- EXPECT_GE(last_set_bitrate_, kReconfigureThresholdKbps);
- EXPECT_NEAR(config->startBitrate,
- last_set_bitrate_,
+ EXPECT_GE(last_set_bitrate_kbps_, kReconfigureThresholdKbps);
+ EXPECT_NEAR(config->startBitrate, last_set_bitrate_kbps_,
kPermittedReconfiguredBitrateDiffKbps)
<< "Encoder reconfigured with bitrate too far away from last set.";
observation_complete_.Set();
@@ -670,14 +671,14 @@ TEST_F(CallPerfTest, KeepsHighBitrateWhenReconfiguringSender) {
return FakeEncoder::InitEncode(config, number_of_cores, max_payload_size);
}
- int32_t SetRates(uint32_t new_target_bitrate_kbps,
- uint32_t framerate) override {
- last_set_bitrate_ = new_target_bitrate_kbps;
+ int32_t SetRateAllocation(const BitrateAllocation& rate_allocation,
+ uint32_t framerate) override {
+ last_set_bitrate_kbps_ = rate_allocation.get_sum_kbps();
if (encoder_inits_ == 1 &&
- new_target_bitrate_kbps > kReconfigureThresholdKbps) {
+ rate_allocation.get_sum_kbps() > kReconfigureThresholdKbps) {
time_to_reconfigure_.Set();
}
- return FakeEncoder::SetRates(new_target_bitrate_kbps, framerate);
+ return FakeEncoder::SetRateAllocation(rate_allocation, framerate);
}
Call::Config GetSenderCallConfig() override {
@@ -723,7 +724,7 @@ TEST_F(CallPerfTest, KeepsHighBitrateWhenReconfiguringSender) {
private:
rtc::Event time_to_reconfigure_;
int encoder_inits_;
- uint32_t last_set_bitrate_;
+ uint32_t last_set_bitrate_kbps_;
VideoSendStream* send_stream_;
test::FrameGeneratorCapturer* frame_generator_;
VideoEncoderConfig encoder_config_;
« 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