Set frame duration per spatial layer.

This allows VP9 encoder correctly calculate target frame budgets when
encoding multiple spatial layers with different frame rate.

Bug: webrtc:9768
Change-Id: I21d76cc1670024710371464898d8b3f8572229b1
Reviewed-on: https://webrtc-review.googlesource.com/c/98865
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25164}
This commit is contained in:
Sergey Silkin
2018-10-02 10:28:10 +02:00
committed by Commit Bot
parent 9ac3c9118a
commit a85995ac66

View File

@ -788,6 +788,14 @@ int VP9EncoderImpl::Encode(const VideoFrame& input_image,
if (external_ref_control_) {
vpx_svc_ref_frame_config_t ref_config = SetReferences(force_key_frame_);
if (VideoCodecMode::kScreensharing == codec_.mode) {
for (uint8_t sl_idx = 0; sl_idx < num_active_spatial_layers_; ++sl_idx) {
ref_config.duration[sl_idx] = static_cast<int64_t>(
90000 / framerate_controller_[sl_idx].GetTargetRate());
}
}
vpx_codec_control(encoder_, VP9E_SET_SVC_REF_FRAME_CONFIG, &ref_config);
}