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

Unified Diff: webrtc/common_video/bitrate_adjuster.cc

Issue 2029593002: Update RateStatistics to handle too-little-data case. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comment Created 4 years, 6 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/base/rate_statistics_unittest.cc ('k') | webrtc/common_video/bitrate_adjuster_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_video/bitrate_adjuster.cc
diff --git a/webrtc/common_video/bitrate_adjuster.cc b/webrtc/common_video/bitrate_adjuster.cc
index ada6c5db4b7bb8cbe25af7e9eefbf3c500bf017a..9c5c077a83334c666df681902972aae101a0fa3d 100644
--- a/webrtc/common_video/bitrate_adjuster.cc
+++ b/webrtc/common_video/bitrate_adjuster.cc
@@ -70,7 +70,7 @@ uint32_t BitrateAdjuster::GetAdjustedBitrateBps() const {
return adjusted_bitrate_bps_;
}
-uint32_t BitrateAdjuster::GetEstimatedBitrateBps() {
+rtc::Optional<uint32_t> BitrateAdjuster::GetEstimatedBitrateBps() {
rtc::CritScope cs(&crit_);
return bitrate_tracker_.Rate(clock_->TimeInMilliseconds());
}
@@ -121,8 +121,9 @@ void BitrateAdjuster::UpdateBitrate(uint32_t current_time_ms) {
frames_since_last_update_ < kBitrateUpdateFrameInterval) {
return;
}
- float estimated_bitrate_bps = bitrate_tracker_.Rate(current_time_ms);
float target_bitrate_bps = target_bitrate_bps_;
+ float estimated_bitrate_bps =
+ bitrate_tracker_.Rate(current_time_ms).value_or(target_bitrate_bps);
float error = target_bitrate_bps - estimated_bitrate_bps;
// Adjust if we've overshot by any amount or if we've undershot too much.
« no previous file with comments | « webrtc/base/rate_statistics_unittest.cc ('k') | webrtc/common_video/bitrate_adjuster_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698