From f87bb463060c2374493226b537e13b69aa8e4d80 Mon Sep 17 00:00:00 2001 From: Sergey Silkin Date: Mon, 17 Sep 2018 09:37:37 +0200 Subject: [PATCH] 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 Commit-Queue: Sergey Silkin Cr-Commit-Position: refs/heads/master@{#24769} --- modules/video_coding/codecs/vp9/vp9_impl.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/video_coding/codecs/vp9/vp9_impl.cc b/modules/video_coding/codecs/vp9/vp9_impl.cc index acbb8751b5..e83a785cbe 100644 --- a/modules/video_coding/codecs/vp9/vp9_impl.cc +++ b/modules/video_coding/codecs/vp9/vp9_impl.cc @@ -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( - 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(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) {