| Index: webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc
 | 
| diff --git a/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc
 | 
| index 85ef1dd16c4ee310d8993b632cf1a4eca9f06b3c..b08b30a8ce0b856aed2310bc9c36cc00892ce01d 100644
 | 
| --- a/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc
 | 
| +++ b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc
 | 
| @@ -11,7 +11,6 @@
 | 
|  #include "webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h"
 | 
|  
 | 
|  #include <limits>
 | 
| -#include <algorithm>
 | 
|  
 | 
|  #include "webrtc/base/checks.h"
 | 
|  #include "webrtc/base/logging.h"
 | 
| @@ -23,10 +22,8 @@
 | 
|  namespace webrtc {
 | 
|  
 | 
|  // TODO(sprang): Tune these!
 | 
| +const int RemoteEstimatorProxy::kDefaultProcessIntervalMs = 50;
 | 
|  const int RemoteEstimatorProxy::kBackWindowMs = 500;
 | 
| -const int RemoteEstimatorProxy::kMinSendIntervalMs = 50;
 | 
| -const int RemoteEstimatorProxy::kMaxSendIntervalMs = 250;
 | 
| -const int RemoteEstimatorProxy::kDefaultSendIntervalMs = 100;
 | 
|  
 | 
|  // The maximum allowed value for a timestamp in milliseconds. This is lower
 | 
|  // than the numerical limit since we often convert to microseconds.
 | 
| @@ -40,8 +37,7 @@
 | 
|        last_process_time_ms_(-1),
 | 
|        media_ssrc_(0),
 | 
|        feedback_sequence_(0),
 | 
| -      window_start_seq_(-1),
 | 
| -      send_interval_ms_(kDefaultSendIntervalMs) {}
 | 
| +      window_start_seq_(-1) {}
 | 
|  
 | 
|  RemoteEstimatorProxy::~RemoteEstimatorProxy() {}
 | 
|  
 | 
| @@ -72,12 +68,11 @@
 | 
|  }
 | 
|  
 | 
|  int64_t RemoteEstimatorProxy::TimeUntilNextProcess() {
 | 
| +  int64_t now = clock_->TimeInMilliseconds();
 | 
|    int64_t time_until_next = 0;
 | 
| -  if (last_process_time_ms_ != -1) {
 | 
| -    rtc::CritScope cs(&lock_);
 | 
| -    int64_t now = clock_->TimeInMilliseconds();
 | 
| -    if (now - last_process_time_ms_ < send_interval_ms_)
 | 
| -      time_until_next = (last_process_time_ms_ + send_interval_ms_ - now);
 | 
| +  if (last_process_time_ms_ != -1 &&
 | 
| +      now - last_process_time_ms_ < kDefaultProcessIntervalMs) {
 | 
| +    time_until_next = (last_process_time_ms_ + kDefaultProcessIntervalMs - now);
 | 
|    }
 | 
|    return time_until_next;
 | 
|  }
 | 
| @@ -95,23 +90,6 @@
 | 
|        more_to_build = false;
 | 
|      }
 | 
|    }
 | 
| -}
 | 
| -
 | 
| -void RemoteEstimatorProxy::OnBitrateChanged(int bitrate_bps) {
 | 
| -  // TwccReportSize = Ipv4(20B) + UDP(8B) + SRTP(10B) +
 | 
| -  // AverageTwccReport(30B)
 | 
| -  // TwccReport size at 50ms interval is 24 byte.
 | 
| -  // TwccReport size at 250ms interval is 36 byte.
 | 
| -  // AverageTwccReport = (TwccReport(50ms) + TwccReport(250ms)) / 2
 | 
| -  constexpr int kTwccReportSize = 20 + 8 + 10 + 30;
 | 
| -
 | 
| -  // Let TWCC reports occupy 5% of total bandwidth.
 | 
| -  rtc::CritScope cs(&lock_);
 | 
| -  send_interval_ms_ = std::min(
 | 
| -      std::max(static_cast<int>(
 | 
| -                   kTwccReportSize * 8.0 * 1000.0 / (0.05 * bitrate_bps) + 0.5),
 | 
| -               kMinSendIntervalMs),
 | 
| -      kMaxSendIntervalMs);
 | 
|  }
 | 
|  
 | 
|  void RemoteEstimatorProxy::OnPacketArrival(uint16_t sequence_number,
 | 
| 
 |