Chromium Code Reviews| Index: webrtc/modules/pacing/alr_detector.cc |
| diff --git a/webrtc/modules/pacing/alr_detector.cc b/webrtc/modules/pacing/alr_detector.cc |
| index 90afe18fef76a3368d1db725e758c5d31ffee8e9..77d23824ea239453a2272a5c981f1a0b71767d34 100644 |
| --- a/webrtc/modules/pacing/alr_detector.cc |
| +++ b/webrtc/modules/pacing/alr_detector.cc |
| @@ -44,10 +44,10 @@ void AlrDetector::OnBytesSent(size_t bytes_sent, int64_t now_ms) { |
| return; |
| int percentage = static_cast<int>(*rate) * 100 / estimated_bitrate_bps_; |
| - if (percentage < kAlrStartUsagePercent && !application_limited_) { |
| - application_limited_ = true; |
| - } else if (percentage > kAlrEndUsagePercent && application_limited_) { |
| - application_limited_ = false; |
| + if (percentage < kAlrStartUsagePercent && !alr_started_time_ms_) { |
| + alr_started_time_ms_ = now_ms; |
| + } else if (percentage > kAlrEndUsagePercent && alr_started_time_ms_) { |
| + alr_started_time_ms_ = 0; |
| } |
| } |
| @@ -56,8 +56,11 @@ void AlrDetector::SetEstimatedBitrate(int bitrate_bps) { |
| estimated_bitrate_bps_ = bitrate_bps; |
| } |
| -bool AlrDetector::InApplicationLimitedRegion() const { |
| - return application_limited_; |
| +rtc::Optional<int64_t> AlrDetector::GetApplicationLimitedRegionStartTime() |
| + const { |
| + return alr_started_time_ms_ == 0 |
| + ? rtc::Optional<int64_t>() |
|
stefan-webrtc
2016/11/28 13:27:13
I would have made alr_started_time_ms_ an rtc::Opt
Sergey Ulanov
2016/11/28 20:39:00
Done.
|
| + : rtc::Optional<int64_t>(alr_started_time_ms_); |
| } |
| } // namespace webrtc |