From e2e000059d1a0a1ceaf787544c833e4945d112aa Mon Sep 17 00:00:00 2001 From: Christoffer Rodbro Date: Thu, 20 Dec 2018 15:46:03 +0100 Subject: [PATCH] Make pacing buffer send interval configurable. Bug: webrtc:10153 Change-Id: I2f71b5fc902e24b87f0b6cba474d988b8c27aefa Reviewed-on: https://webrtc-review.googlesource.com/c/115301 Commit-Queue: Christoffer Rodbro Reviewed-by: Sebastian Jansson Cr-Commit-Position: refs/heads/master@{#26076} --- modules/pacing/BUILD.gn | 1 + modules/pacing/paced_sender.cc | 12 ++++++++---- modules/pacing/paced_sender.h | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/pacing/BUILD.gn b/modules/pacing/BUILD.gn index 25284980cd..1b3716866b 100644 --- a/modules/pacing/BUILD.gn +++ b/modules/pacing/BUILD.gn @@ -36,6 +36,7 @@ rtc_static_library("pacing") { "../../rtc_base:checks", "../../rtc_base:rtc_base_approved", "../../rtc_base/experiments:alr_experiment", + "../../rtc_base/experiments:field_trial_parser", "../../system_wrappers", "../../system_wrappers:field_trial", "../congestion_controller/goog_cc:alr_detector", diff --git a/modules/pacing/paced_sender.cc b/modules/pacing/paced_sender.cc index 050fbb651a..f512938557 100644 --- a/modules/pacing/paced_sender.cc +++ b/modules/pacing/paced_sender.cc @@ -26,7 +26,7 @@ namespace { // Time limit in milliseconds between packet bursts. -const int64_t kMinPacketLimitMs = 5; +const int64_t kDefaultMinPacketLimitMs = 5; const int64_t kCongestedPacketIntervalMs = 500; const int64_t kPausedProcessIntervalMs = kCongestedPacketIntervalMs; const int64_t kMaxElapsedTimeMs = 2000; @@ -52,6 +52,7 @@ PacedSender::PacedSender(const Clock* clock, send_padding_if_silent_( field_trial::IsEnabled("WebRTC-Pacer-PadInSilence")), video_blocks_audio_(!field_trial::IsDisabled("WebRTC-Pacer-BlockAudio")), + min_packet_limit_ms_("", kDefaultMinPacketLimitMs), last_timestamp_ms_(clock_->TimeInMilliseconds()), paused_(false), media_budget_(0), @@ -70,10 +71,13 @@ PacedSender::PacedSender(const Clock* clock, pacing_factor_(kDefaultPaceMultiplier), queue_time_limit(kMaxQueueLengthMs), account_for_audio_(false) { - if (!drain_large_queues_) + if (!drain_large_queues_) { RTC_LOG(LS_WARNING) << "Pacer queues will not be drained," "pushback experiment must be enabled."; - UpdateBudgetWithElapsedTime(kMinPacketLimitMs); + } + ParseFieldTrial({&min_packet_limit_ms_}, + field_trial::FindFullName("WebRTC-Pacer-MinPacketLimitMs")); + UpdateBudgetWithElapsedTime(min_packet_limit_ms_); } PacedSender::~PacedSender() {} @@ -258,7 +262,7 @@ int64_t PacedSender::TimeUntilNextProcess() { if (ret > 0 || (ret == 0 && !probing_send_failure_)) return ret; } - return std::max(kMinPacketLimitMs - elapsed_time_ms, 0); + return std::max(min_packet_limit_ms_ - elapsed_time_ms, 0); } int64_t PacedSender::UpdateTimeAndGetElapsedMs(int64_t now_us) { diff --git a/modules/pacing/paced_sender.h b/modules/pacing/paced_sender.h index 6c88159e53..7b8ecc1c6a 100644 --- a/modules/pacing/paced_sender.h +++ b/modules/pacing/paced_sender.h @@ -24,6 +24,7 @@ #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "modules/utility/include/process_thread.h" #include "rtc_base/criticalsection.h" +#include "rtc_base/experiments/field_trial_parser.h" #include "rtc_base/thread_annotations.h" namespace webrtc { @@ -172,6 +173,7 @@ class PacedSender : public Pacer { const bool drain_large_queues_; const bool send_padding_if_silent_; const bool video_blocks_audio_; + FieldTrialParameter min_packet_limit_ms_; rtc::CriticalSection critsect_; // TODO(webrtc:9716): Remove this when we are certain clocks are monotonic.