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. |