From 3226e563d8adb25ae8f5f6b6030089235bbc90ef Mon Sep 17 00:00:00 2001 From: Sergey Silkin Date: Mon, 17 Jan 2022 14:29:02 +0100 Subject: [PATCH] Reland "Disable frame dropping from codec settings." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a reland of 34aba3cefd9519a8da6700f725a9e2d99ee2ef61 Original change's description: > Disable frame dropping from codec settings. > > This was broken in https://webrtc-review.googlesource.com/c/src/+/99062/ > > Bug: webrtc:9734 > Change-Id: Ibce41a732cb2e943354c87fbb05be0dd218acf27 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/242366 > Reviewed-by: Erik Språng > Commit-Queue: Sergey Silkin > Cr-Commit-Position: refs/heads/main@{#35568} Bug: webrtc:9734 Change-Id: I84efcab334b99aa08b07cc5e891681bfd5b2865f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/247182 Reviewed-by: Erik Språng Commit-Queue: Sergey Silkin Cr-Commit-Position: refs/heads/main@{#35712} --- modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc | 11 +++++++---- .../video_coding/codecs/vp8/test/vp8_impl_unittest.cc | 5 ----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc index 17220b14dd..a613be4154 100644 --- a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc +++ b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc @@ -856,16 +856,19 @@ uint32_t LibvpxVp8Encoder::MaxIntraTarget(uint32_t optimalBuffersize) { } uint32_t LibvpxVp8Encoder::FrameDropThreshold(size_t spatial_idx) const { - bool enable_frame_dropping = codec_.VP8().frameDroppingOn; + if (!codec_.VP8().frameDroppingOn) { + return 0; + } + // If temporal layers are used, they get to override the frame dropping // setting, as eg. ScreenshareLayers does not work as intended with frame // dropping on and DefaultTemporalLayers will have performance issues with // frame dropping off. RTC_DCHECK(frame_buffer_controller_); RTC_DCHECK_LT(spatial_idx, frame_buffer_controller_->StreamCount()); - enable_frame_dropping = - frame_buffer_controller_->SupportsEncoderFrameDropping(spatial_idx); - return enable_frame_dropping ? 30 : 0; + return frame_buffer_controller_->SupportsEncoderFrameDropping(spatial_idx) + ? 30 + : 0; } size_t LibvpxVp8Encoder::SteadyStateSize(int sid, int tid) { diff --git a/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc b/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc index 2e2597e397..c257edd7c1 100644 --- a/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc +++ b/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc @@ -76,9 +76,6 @@ class TestVp8Impl : public VideoCodecUnitTest { webrtc::test::CodecSettings(kVideoCodecVP8, codec_settings); codec_settings->width = kWidth; codec_settings->height = kHeight; - codec_settings->VP8()->denoisingOn = true; - codec_settings->VP8()->frameDroppingOn = false; - codec_settings->VP8()->automaticResizeOn = false; codec_settings->VP8()->complexity = VideoCodecComplexity::kComplexityNormal; } @@ -408,7 +405,6 @@ TEST_F(TestVp8Impl, EncoderWith2TemporalLayers) { } TEST_F(TestVp8Impl, ScalingDisabledIfAutomaticResizeOff) { - codec_settings_.VP8()->frameDroppingOn = true; codec_settings_.VP8()->automaticResizeOn = false; EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->InitEncode(&codec_settings_, kSettings)); @@ -419,7 +415,6 @@ TEST_F(TestVp8Impl, ScalingDisabledIfAutomaticResizeOff) { } TEST_F(TestVp8Impl, ScalingEnabledIfAutomaticResizeOn) { - codec_settings_.VP8()->frameDroppingOn = true; codec_settings_.VP8()->automaticResizeOn = true; EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->InitEncode(&codec_settings_, kSettings));