Restrict use of frame rate controller.

VP9 frame rate controller is supposed to be used in screen mode only
but it was partially enabled in normal video mode. This restricts use
of VP9 frame rate controller to screen mode.

Bug: chromium:884164
Change-Id: Ie2eaa31f3364a8abccbc4171007708cf7040fc38
Reviewed-on: https://webrtc-review.googlesource.com/100424
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24769}
This commit is contained in:
Sergey Silkin
2018-09-17 09:37:37 +02:00
committed by Commit Bot
parent 33a5852829
commit f87bb46306

View File

@ -774,9 +774,12 @@ int VP9EncoderImpl::Encode(const VideoFrame& input_image,
// (not 'expected' time). Then rate controller can drain buffer more
// accurately.
RTC_DCHECK_GE(framerate_controller_.size(), num_active_spatial_layers_);
uint32_t duration = static_cast<uint32_t>(
90000 /
framerate_controller_[num_active_spatial_layers_ - 1].GetTargetRate());
float target_framerate_fps =
(codec_.mode == VideoCodecMode::kScreensharing)
? framerate_controller_[num_active_spatial_layers_ - 1]
.GetTargetRate()
: codec_.maxFramerate;
uint32_t duration = static_cast<uint32_t>(90000 / target_framerate_fps);
const vpx_codec_err_t rv = vpx_codec_encode(encoder_, raw_, timestamp_,
duration, flags, VPX_DL_REALTIME);
if (rv != VPX_CODEC_OK) {