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

Unified Diff: webrtc/test/fake_encoder.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/test/fake_encoder.h ('k') | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/test/fake_encoder.cc
diff --git a/webrtc/test/fake_encoder.cc b/webrtc/test/fake_encoder.cc
index f518ce39192adaca53f2541768b4a7a05648f2bf..26ce0c66083bbaf56f65df68c94be64388e93dfd 100644
--- a/webrtc/test/fake_encoder.cc
+++ b/webrtc/test/fake_encoder.cc
@@ -23,7 +23,6 @@ namespace test {
FakeEncoder::FakeEncoder(Clock* clock)
: clock_(clock),
callback_(NULL),
- target_bitrate_kbps_(0),
max_target_bitrate_kbps_(-1),
last_encode_time_ms_(0) {
// Generate some arbitrary not-all-zero data
@@ -43,7 +42,7 @@ int32_t FakeEncoder::InitEncode(const VideoCodec* config,
int32_t number_of_cores,
size_t max_payload_size) {
config_ = *config;
- target_bitrate_kbps_ = config_.startBitrate;
+ target_bitrate_.SetBitrate(0, 0, config_.startBitrate * 1000);
return 0;
}
@@ -65,8 +64,8 @@ int32_t FakeEncoder::Encode(const VideoFrame& input_image,
time_since_last_encode_ms = 3 * 1000 / config_.maxFramerate;
}
- size_t bits_available =
- static_cast<size_t>(target_bitrate_kbps_ * time_since_last_encode_ms);
+ size_t bits_available = static_cast<size_t>(target_bitrate_.get_sum_kbps() *
+ time_since_last_encode_ms);
size_t min_bits = static_cast<size_t>(
config_.simulcastStream[0].minBitrate * time_since_last_encode_ms);
if (bits_available < min_bits)
@@ -133,8 +132,9 @@ int32_t FakeEncoder::SetChannelParameters(uint32_t packet_loss, int64_t rtt) {
return 0;
}
-int32_t FakeEncoder::SetRates(uint32_t new_target_bitrate, uint32_t framerate) {
- target_bitrate_kbps_ = new_target_bitrate;
+int32_t FakeEncoder::SetRateAllocation(const BitrateAllocation& rate_allocation,
+ uint32_t framerate) {
+ target_bitrate_ = rate_allocation;
return 0;
}
« no previous file with comments | « webrtc/test/fake_encoder.h ('k') | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698