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; |