Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3065)

Unified Diff: webrtc/video/vie_encoder.cc

Issue 2666303002: Revert of Drop frames until specified bitrate is achieved. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/video/vie_encoder.h ('k') | webrtc/video/vie_encoder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/vie_encoder.cc
diff --git a/webrtc/video/vie_encoder.cc b/webrtc/video/vie_encoder.cc
index b149db73bf009e767773d24793e834eb4155cf7c..eaf693af169392883496a2f7fff370029248b433 100644
--- a/webrtc/video/vie_encoder.cc
+++ b/webrtc/video/vie_encoder.cc
@@ -42,10 +42,6 @@
const int kMinPixelsPerFrame = 120 * 90;
#endif
-// The maximum number of frames to drop at beginning of stream
-// to try and achieve desired bitrate.
-const int kMaxInitialFramedrop = 4;
-
// TODO(pbos): Lower these thresholds (to closer to 100%) when we handle
// pipelining encoders better (multiple input frames before something comes
// out). This should effectively turn off CPU adaptations for systems that
@@ -57,17 +53,6 @@
options.high_encode_usage_threshold_percent = 200;
}
return options;
-}
-
-uint32_t MaximumFrameSizeForBitrate(uint32_t kbps) {
- if (kbps > 0) {
- if (kbps < 300 /* qvga */) {
- return 320 * 240;
- } else if (kbps < 500 /* vga */) {
- return 640 * 480;
- }
- }
- return std::numeric_limits<uint32_t>::max();
}
} // namespace
@@ -259,7 +244,6 @@
EncodedFrameObserver* encoder_timing)
: shutdown_event_(true /* manual_reset */, false),
number_of_cores_(number_of_cores),
- initial_rampup_(0),
source_proxy_(new VideoSourceProxy(this)),
sink_(nullptr),
settings_(settings),
@@ -357,8 +341,8 @@
RTC_DCHECK_RUN_ON(&encoder_queue_);
scaling_enabled_ = (degradation_preference !=
VideoSendStream::DegradationPreference::kMaintainResolution);
- initial_rampup_ = scaling_enabled_ ? 0 : kMaxInitialFramedrop;
- ConfigureQualityScaler();
+ stats_proxy_->SetResolutionRestrictionStats(
+ scaling_enabled_, scale_counter_[kCpu] > 0, scale_counter_[kQuality]);
});
}
@@ -453,14 +437,8 @@
sink_->OnEncoderConfigurationChanged(
std::move(streams), encoder_config_.min_transmit_bitrate_bps);
- ConfigureQualityScaler();
-}
-
-void ViEEncoder::ConfigureQualityScaler() {
- RTC_DCHECK_RUN_ON(&encoder_queue_);
const auto scaling_settings = settings_.encoder->GetScalingSettings();
if (scaling_enabled_ && scaling_settings.enabled) {
- // Drop frames and scale down until desired quality is achieved.
if (scaling_settings.thresholds) {
quality_scaler_.reset(
new QualityScaler(this, *(scaling_settings.thresholds)));
@@ -469,9 +447,9 @@
}
} else {
quality_scaler_.reset(nullptr);
- }
- stats_proxy_->SetResolutionRestrictionStats(
- scaling_enabled_, scale_counter_[kCpu] > 0, scale_counter_[kQuality]);
+ stats_proxy_->SetResolutionRestrictionStats(
+ false, scale_counter_[kCpu] > 0, scale_counter_[kQuality]);
+ }
}
void ViEEncoder::OnFrame(const VideoFrame& video_frame) {
@@ -567,16 +545,6 @@
<< ", texture=" << last_frame_info_->is_texture;
}
- if (initial_rampup_ < kMaxInitialFramedrop &&
- video_frame.size() >
- MaximumFrameSizeForBitrate(encoder_start_bitrate_bps_ / 1000)) {
- LOG(LS_INFO) << "Dropping frame. Too large for target bitrate.";
- ScaleDown(kQuality);
- ++initial_rampup_;
- return;
- }
- initial_rampup_ = kMaxInitialFramedrop;
-
int64_t now_ms = clock_->TimeInMilliseconds();
if (pending_encoder_reconfiguration_) {
ReconfigureEncoder();
« no previous file with comments | « webrtc/video/vie_encoder.h ('k') | webrtc/video/vie_encoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698