From 20bede7cc7df7a0fea3f2ee060ad6cef1d1dc6f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Spr=C3=A5ng?= Date: Fri, 5 May 2023 16:18:10 +0200 Subject: [PATCH] Clean up dead code in vp9 encoder wrapper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: None Change-Id: Ic99af40e95c5d82db9b4b5624eae3103d0a11c55 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/304286 Auto-Submit: Erik Språng Reviewed-by: Philip Eliasson Commit-Queue: Erik Språng Cr-Commit-Position: refs/heads/main@{#40027} --- .../codecs/vp9/libvpx_vp9_encoder.cc | 30 +++---------------- .../codecs/vp9/libvpx_vp9_encoder.h | 2 -- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc b/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc index e05428964d..e460625aea 100644 --- a/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc +++ b/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc @@ -249,8 +249,6 @@ LibvpxVp9Encoder::LibvpxVp9Encoder(const cricket::VideoCodec& codec, trusted_rate_controller_( RateControlSettings::ParseFromKeyValueConfig(&trials) .LibvpxVp9TrustedRateController()), - layer_buffering_(false), - full_superframe_drop_(true), first_frame_in_picture_(true), ss_info_needed_(false), force_all_active_layers_(false), @@ -920,18 +918,11 @@ int LibvpxVp9Encoder::InitAndSetControlSettings(const VideoCodec* inst) { for (size_t i = 0; i < num_spatial_layers_; ++i) { svc_drop_frame_.framedrop_thresh[i] = config_->rc_dropframe_thresh; } - // No buffering is needed because the highest layer is always present in - // all frames in CONSTRAINED_FROM_ABOVE drop mode. - layer_buffering_ = false; } else { // Configure encoder to drop entire superframe whenever it needs to drop // a layer. This mode is preferred over per-layer dropping which causes // quality flickering and is not compatible with RTP non-flexible mode. - svc_drop_frame_.framedrop_mode = - full_superframe_drop_ ? FULL_SUPERFRAME_DROP : CONSTRAINED_LAYER_DROP; - // Buffering is needed only for constrained layer drop, as it's not clear - // which frame is the last. - layer_buffering_ = !full_superframe_drop_; + svc_drop_frame_.framedrop_mode = FULL_SUPERFRAME_DROP; svc_drop_frame_.max_consec_drop = std::numeric_limits::max(); for (size_t i = 0; i < num_spatial_layers_; ++i) { svc_drop_frame_.framedrop_thresh[i] = config_->rc_dropframe_thresh; @@ -1276,11 +1267,6 @@ int LibvpxVp9Encoder::Encode(const VideoFrame& input_image, } timestamp_ += duration; - if (layer_buffering_) { - const bool end_of_picture = true; - DeliverBufferedFrame(end_of_picture); - } - return WEBRTC_VIDEO_CODEC_OK; } @@ -1715,12 +1701,6 @@ void LibvpxVp9Encoder::GetEncodedLayerFrame(const vpx_codec_cx_pkt* pkt) { vpx_svc_layer_id_t layer_id = {0}; libvpx_->codec_control(encoder_, VP9E_GET_SVC_LAYER_ID, &layer_id); - if (layer_buffering_) { - // Deliver buffered low spatial layer frame. - const bool end_of_picture = false; - DeliverBufferedFrame(end_of_picture); - } - encoded_image_.SetEncodedData(EncodedImageBuffer::Create( static_cast(pkt->data.frame.buf), pkt->data.frame.sz)); @@ -1765,11 +1745,9 @@ void LibvpxVp9Encoder::GetEncodedLayerFrame(const vpx_codec_cx_pkt* pkt) { libvpx_->codec_control(encoder_, VP8E_GET_LAST_QUANTIZER, &qp); encoded_image_.qp_ = qp; - if (!layer_buffering_) { - const bool end_of_picture = encoded_image_.SpatialIndex().value_or(0) + 1 == - num_active_spatial_layers_; - DeliverBufferedFrame(end_of_picture); - } + const bool end_of_picture = encoded_image_.SpatialIndex().value_or(0) + 1 == + num_active_spatial_layers_; + DeliverBufferedFrame(end_of_picture); } void LibvpxVp9Encoder::DeliverBufferedFrame(bool end_of_picture) { diff --git a/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.h b/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.h index 6b662ae8f9..0474e7bc17 100644 --- a/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.h +++ b/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.h @@ -143,8 +143,6 @@ class LibvpxVp9Encoder : public VP9Encoder { InterLayerPredMode inter_layer_pred_; bool external_ref_control_; const bool trusted_rate_controller_; - bool layer_buffering_; - const bool full_superframe_drop_; vpx_svc_frame_drop_t svc_drop_frame_; bool first_frame_in_picture_; VideoBitrateAllocation current_bitrate_allocation_;