mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
Move field trial check WebRTC-DisableRtxRateLimiter
Checking in sending classes avoids using global field trial string in favor of the injected one. In addition to that RateLimiter looks wrong layer for check that field trial: checking inside RateLimiter class might be surprising if it is used for limiting something else than RTX bitrate. evaluating field trial for each retransmitting packet might be expensive Bug: webrtc:15184, webrtc:10335 Change-Id: I87bae3522bbd9692629d4f9b6caa119be03f2bd6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/322720 Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Ying Wang <yinwa@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#40908}
This commit is contained in:
parent
c4f3919fdd
commit
c941579e95
5 changed files with 8 additions and 22 deletions
|
@ -411,8 +411,10 @@ ChannelSend::ChannelSend(
|
|||
|
||||
configuration.event_log = event_log_;
|
||||
configuration.rtt_stats = rtcp_rtt_stats;
|
||||
configuration.retransmission_rate_limiter =
|
||||
retransmission_rate_limiter_.get();
|
||||
if (!field_trials.IsEnabled("WebRTC-DisableRtxRateLimiter")) {
|
||||
configuration.retransmission_rate_limiter =
|
||||
retransmission_rate_limiter_.get();
|
||||
}
|
||||
configuration.extmap_allow_mixed = extmap_allow_mixed;
|
||||
configuration.rtcp_report_interval_ms = rtcp_report_interval_ms;
|
||||
configuration.rtcp_packet_type_counter_observer = this;
|
||||
|
|
|
@ -226,7 +226,9 @@ std::vector<RtpStreamSender> CreateRtpStreamSenders(
|
|||
configuration.send_bitrate_observer = observers.bitrate_observer;
|
||||
configuration.send_packet_observer = observers.send_packet_observer;
|
||||
configuration.event_log = event_log;
|
||||
configuration.retransmission_rate_limiter = retransmission_rate_limiter;
|
||||
if (!trials.IsEnabled("WebRTC-DisableRtxRateLimiter")) {
|
||||
configuration.retransmission_rate_limiter = retransmission_rate_limiter;
|
||||
}
|
||||
configuration.rtp_stats_callback = observers.rtp_stats;
|
||||
configuration.frame_encryptor = frame_encryptor;
|
||||
configuration.require_frame_encryption =
|
||||
|
|
|
@ -525,7 +525,6 @@ rtc_library("rate_limiter") {
|
|||
":macromagic",
|
||||
":rate_statistics",
|
||||
"../system_wrappers",
|
||||
"../system_wrappers:field_trial",
|
||||
"synchronization:mutex",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
|
@ -1964,7 +1963,6 @@ if (rtc_include_tests) {
|
|||
"../api/units:time_delta",
|
||||
"../api/units:timestamp",
|
||||
"../system_wrappers",
|
||||
"../test:field_trial",
|
||||
"../test:fileutils",
|
||||
"../test:test_main",
|
||||
"../test:test_support",
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include "absl/types/optional.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
@ -35,8 +34,7 @@ bool RateLimiter::TryUseRate(size_t packet_size_bytes) {
|
|||
MutexLock lock(&lock_);
|
||||
int64_t now_ms = clock_->TimeInMilliseconds();
|
||||
absl::optional<uint32_t> current_rate = current_rate_.Rate(now_ms);
|
||||
if (!webrtc::field_trial::IsEnabled("WebRTC-DisableRtxRateLimiter") &&
|
||||
current_rate) {
|
||||
if (current_rate) {
|
||||
// If there is a current rate, check if adding bytes would cause maximum
|
||||
// bitrate target to be exceeded. If there is NOT a valid current rate,
|
||||
// allow allocating rate even if target is exceeded. This prevents
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "rtc_base/event.h"
|
||||
#include "rtc_base/platform_thread.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
#include "test/field_trial.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -107,19 +106,6 @@ TEST_F(RateLimitTest, WindowSizeLimits) {
|
|||
EXPECT_FALSE(rate_limiter->SetWindowSize(kWindowSizeMs + 1));
|
||||
}
|
||||
|
||||
TEST_F(RateLimitTest, DiablesRtxRateLimiterByFieldTrial) {
|
||||
webrtc::test::ScopedFieldTrials trial(
|
||||
"WebRTC-DisableRtxRateLimiter/Enabled/");
|
||||
|
||||
// Fill rate, extend window to full size.
|
||||
EXPECT_TRUE(rate_limiter->TryUseRate(kRateFillingBytes / 2));
|
||||
clock_.AdvanceTimeMilliseconds(kWindowSizeMs - 1);
|
||||
EXPECT_TRUE(rate_limiter->TryUseRate(kRateFillingBytes / 2));
|
||||
|
||||
// Does not limit rate even when all rate consumed.
|
||||
EXPECT_TRUE(rate_limiter->TryUseRate(1));
|
||||
}
|
||||
|
||||
static constexpr TimeDelta kMaxTimeout = TimeDelta::Seconds(30);
|
||||
|
||||
class ThreadTask {
|
||||
|
|
Loading…
Reference in a new issue