Fixing issue where pacer budget increased in congestion.

This fixes an issue where the media budget in the pacer was allowed to
increase more than the process interval when congested.

Bug: webrtc:8415
Change-Id: I79bf965b6a72ed88313074cdae4746fcaff63340
Reviewed-on: https://webrtc-review.googlesource.com/80121
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23531}
This commit is contained in:
Sebastian Jansson
2018-06-04 19:02:41 +02:00
committed by Commit Bot
parent 6cb74fd77a
commit b544f6c2f5
2 changed files with 45 additions and 2 deletions

View File

@ -255,8 +255,8 @@ int64_t PacedSender::TimeUntilNextProcess() {
void PacedSender::Process() {
int64_t now_us = clock_->TimeInMicroseconds();
rtc::CritScope cs(&critsect_);
int64_t elapsed_time_ms = (now_us - time_last_process_us_ + 500) / 1000;
time_last_process_us_ = now_us;
int64_t elapsed_time_ms = (now_us - last_send_time_us_ + 500) / 1000;
if (elapsed_time_ms > kMaxElapsedTimeMs) {
RTC_LOG(LS_WARNING) << "Elapsed time (" << elapsed_time_ms
<< " ms) longer than expected, limiting to "
@ -268,7 +268,8 @@ void PacedSender::Process() {
// TODO(srte): Stop sending packet in paused state when pause is no longer
// used for congestion windows.
if (paused_ || Congested()) {
if (elapsed_time_ms >= kCongestedPacketIntervalMs) {
int64_t elapsed_since_last_send_us = now_us - last_send_time_us_;
if (elapsed_since_last_send_us >= kCongestedPacketIntervalMs * 1000) {
// We can not send padding unless a normal packet has first been sent. If
// we do, timestamps get messed up.
if (packet_counter_ > 0) {