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

Unified Diff: webrtc/modules/video_coding/codecs/vp9/vp9_impl.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/modules/video_coding/codecs/vp9/vp9_impl.h ('k') | webrtc/modules/video_coding/generic_encoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc
diff --git a/webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc b/webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc
index a4f74b7b44c3b2bfd401c9192dfb07f29be25497..97f745b50b82317cd149badd195cd188cf41cd83 100644
--- a/webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc
+++ b/webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc
@@ -77,6 +77,7 @@ VP9EncoderImpl::VP9EncoderImpl()
frames_since_kf_(0),
num_temporal_layers_(0),
num_spatial_layers_(0),
+ is_flexible_mode_(false),
frames_encoded_(0),
// Use two spatial when screensharing with flexible mode.
spatial_layer_(new ScreenshareLayersVP9(2)) {
@@ -193,24 +194,28 @@ bool VP9EncoderImpl::SetSvcRates() {
return true;
}
-int VP9EncoderImpl::SetRates(uint32_t new_bitrate_kbit,
- uint32_t new_framerate) {
+int VP9EncoderImpl::SetRateAllocation(
+ const BitrateAllocation& bitrate_allocation,
+ uint32_t frame_rate) {
if (!inited_) {
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
}
if (encoder_->err) {
return WEBRTC_VIDEO_CODEC_ERROR;
}
- if (new_framerate < 1) {
+ if (frame_rate < 1) {
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
}
// Update bit rate
- if (codec_.maxBitrate > 0 && new_bitrate_kbit > codec_.maxBitrate) {
- new_bitrate_kbit = codec_.maxBitrate;
+ if (codec_.maxBitrate > 0 &&
+ bitrate_allocation.get_sum_kbps() > codec_.maxBitrate) {
+ return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
}
- config_->rc_target_bitrate = new_bitrate_kbit;
- codec_.maxFramerate = new_framerate;
- spatial_layer_->ConfigureBitrate(new_bitrate_kbit, 0);
+
+ // TODO(sprang): Actually use BitrateAllocation layer info.
+ config_->rc_target_bitrate = bitrate_allocation.get_sum_kbps();
+ codec_.maxFramerate = frame_rate;
+ spatial_layer_->ConfigureBitrate(bitrate_allocation.get_sum_kbps(), 0);
if (!SetSvcRates()) {
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
« no previous file with comments | « webrtc/modules/video_coding/codecs/vp9/vp9_impl.h ('k') | webrtc/modules/video_coding/generic_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698