From bd06b76e5b92bbff5ce70bfdbe7ceb725735b168 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85sa=20Persson?= Date: Mon, 29 Mar 2021 14:09:04 +0200 Subject: [PATCH] VideoStreamEncoder: Remove unused member variables: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit encoder_bitrate_limits_ quality_scaling_experiment_enabled_ Bug: none Change-Id: Ifb2b839c826f3d1e416db877d3133ac6ad969000 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213141 Commit-Queue: Åsa Persson Reviewed-by: Sergey Silkin Cr-Commit-Position: refs/heads/master@{#33587} --- video/video_stream_encoder.cc | 25 ++++++++++++------------- video/video_stream_encoder.h | 10 +++------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc index 07094e1a39..191918a591 100644 --- a/video/video_stream_encoder.cc +++ b/video/video_stream_encoder.cc @@ -592,7 +592,6 @@ VideoStreamEncoder::VideoStreamEncoder( BitrateAllocationCallbackType allocation_cb_type) : main_queue_(TaskQueueBase::Current()), number_of_cores_(number_of_cores), - quality_scaling_experiment_enabled_(QualityScalingExperiment::Enabled()), sink_(nullptr), settings_(settings), allocation_cb_type_(allocation_cb_type), @@ -913,11 +912,11 @@ void VideoStreamEncoder::ReconfigureEncoder() { crop_width_ = last_frame_info_->width - highest_stream_width; crop_height_ = last_frame_info_->height - highest_stream_height; - encoder_bitrate_limits_ = + absl::optional encoder_bitrate_limits = encoder_->GetEncoderInfo().GetEncoderBitrateLimitsForResolution( last_frame_info_->width * last_frame_info_->height); - if (encoder_bitrate_limits_) { + if (encoder_bitrate_limits) { if (streams.size() == 1 && encoder_config_.simulcast_layers.size() == 1) { // Bitrate limits can be set by app (in SDP or RtpEncodingParameters) // or/and can be provided by encoder. In presence of both set of limits, @@ -925,9 +924,9 @@ void VideoStreamEncoder::ReconfigureEncoder() { int min_bitrate_bps; if (encoder_config_.simulcast_layers.empty() || encoder_config_.simulcast_layers[0].min_bitrate_bps <= 0) { - min_bitrate_bps = encoder_bitrate_limits_->min_bitrate_bps; + min_bitrate_bps = encoder_bitrate_limits->min_bitrate_bps; } else { - min_bitrate_bps = std::max(encoder_bitrate_limits_->min_bitrate_bps, + min_bitrate_bps = std::max(encoder_bitrate_limits->min_bitrate_bps, streams.back().min_bitrate_bps); } @@ -936,9 +935,9 @@ void VideoStreamEncoder::ReconfigureEncoder() { // here since encoder_config_.max_bitrate_bps is derived from it (as // well as from other inputs). if (encoder_config_.max_bitrate_bps <= 0) { - max_bitrate_bps = encoder_bitrate_limits_->max_bitrate_bps; + max_bitrate_bps = encoder_bitrate_limits->max_bitrate_bps; } else { - max_bitrate_bps = std::min(encoder_bitrate_limits_->max_bitrate_bps, + max_bitrate_bps = std::min(encoder_bitrate_limits->max_bitrate_bps, streams.back().max_bitrate_bps); } @@ -947,12 +946,12 @@ void VideoStreamEncoder::ReconfigureEncoder() { streams.back().max_bitrate_bps = max_bitrate_bps; streams.back().target_bitrate_bps = std::min(streams.back().target_bitrate_bps, - encoder_bitrate_limits_->max_bitrate_bps); + encoder_bitrate_limits->max_bitrate_bps); } else { RTC_LOG(LS_WARNING) << "Bitrate limits provided by encoder" - << " (min=" << encoder_bitrate_limits_->min_bitrate_bps - << ", max=" << encoder_bitrate_limits_->min_bitrate_bps + << " (min=" << encoder_bitrate_limits->min_bitrate_bps + << ", max=" << encoder_bitrate_limits->max_bitrate_bps << ") do not intersect with limits set by app" << " (min=" << streams.back().min_bitrate_bps << ", max=" << encoder_config_.max_bitrate_bps @@ -1298,7 +1297,7 @@ void VideoStreamEncoder::OnFrame(const VideoFrame& video_frame) { MaybeEncodeVideoFrame(incoming_frame, post_time_us); } else { if (cwnd_frame_drop) { - // Frame drop by congestion window pusback. Do not encode this + // Frame drop by congestion window pushback. Do not encode this // frame. ++dropped_frame_cwnd_pushback_count_; encoder_stats_observer_->OnFrameDropped( @@ -1435,7 +1434,7 @@ void VideoStreamEncoder::SetEncoderRates( // |bitrate_allocation| is 0 it means that the network is down or the send // pacer is full. We currently only report this if the encoder has an internal // source. If the encoder does not have an internal source, higher levels - // are expected to not call AddVideoFrame. We do this since its unclear + // are expected to not call AddVideoFrame. We do this since it is unclear // how current encoder implementations behave when given a zero target // bitrate. // TODO(perkj): Make sure all known encoder implementations handle zero @@ -1496,7 +1495,7 @@ void VideoStreamEncoder::MaybeEncodeVideoFrame(const VideoFrame& video_frame, VideoFrame::UpdateRect{0, 0, video_frame.width(), video_frame.height()}; } - // We have to create then encoder before the frame drop logic, + // We have to create the encoder before the frame drop logic, // because the latter depends on encoder_->GetScalingSettings. // According to the testcase // InitialFrameDropOffWhenEncoderDisabledScaling, the return value diff --git a/video/video_stream_encoder.h b/video/video_stream_encoder.h index 62119aa258..9e70203661 100644 --- a/video/video_stream_encoder.h +++ b/video/video_stream_encoder.h @@ -182,7 +182,7 @@ class VideoStreamEncoder : public VideoStreamEncoderInterface, void EncodeVideoFrame(const VideoFrame& frame, int64_t time_when_posted_in_ms); - // Indicates wether frame should be dropped because the pixel count is too + // Indicates whether frame should be dropped because the pixel count is too // large for the current bitrate configuration. bool DropDueToSize(uint32_t pixel_count) const RTC_RUN_ON(&encoder_queue_); @@ -230,8 +230,6 @@ class VideoStreamEncoder : public VideoStreamEncoderInterface, const uint32_t number_of_cores_; - const bool quality_scaling_experiment_enabled_; - EncoderSink* sink_; const VideoStreamEncoderSettings settings_; const BitrateAllocationCallbackType allocation_cb_type_; @@ -315,8 +313,6 @@ class VideoStreamEncoder : public VideoStreamEncoderInterface, absl::optional last_encode_info_ms_ RTC_GUARDED_BY(&encoder_queue_); VideoEncoder::EncoderInfo encoder_info_ RTC_GUARDED_BY(&encoder_queue_); - absl::optional encoder_bitrate_limits_ - RTC_GUARDED_BY(&encoder_queue_); VideoEncoderFactory::CodecInfo codec_info_ RTC_GUARDED_BY(&encoder_queue_); VideoCodec send_codec_ RTC_GUARDED_BY(&encoder_queue_); @@ -373,7 +369,7 @@ class VideoStreamEncoder : public VideoStreamEncoderInterface, AutomaticAnimationDetectionExperiment automatic_animation_detection_experiment_ RTC_GUARDED_BY(&encoder_queue_); - // Provies video stream input states: current resolution and frame rate. + // Provides video stream input states: current resolution and frame rate. VideoStreamInputStateProvider input_state_provider_; std::unique_ptr video_stream_adapter_ @@ -389,7 +385,7 @@ class VideoStreamEncoder : public VideoStreamEncoderInterface, RTC_GUARDED_BY(&encoder_queue_); // Handles input, output and stats reporting related to VideoStreamEncoder // specific resources, such as "encode usage percent" measurements and "QP - // scaling". Also involved with various mitigations such as inital frame + // scaling". Also involved with various mitigations such as initial frame // dropping. // The manager primarily operates on the |encoder_queue_| but its lifetime is // tied to the VideoStreamEncoder (which is destroyed off the encoder queue)