Add option to disable reduced jitter delay through field trial.
Bug: none
Change-Id: Id07cb7dd69cd6198eb95a5e9c0987943471f7da2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175565
Reviewed-by: Christoffer Rodbro <crodbro@webrtc.org>
Commit-Queue: Åsa Persson <asapersson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31320}
diff --git a/modules/video_coding/jitter_estimator.cc b/modules/video_coding/jitter_estimator.cc
index cd50583..44e2a98 100644
--- a/modules/video_coding/jitter_estimator.cc
+++ b/modules/video_coding/jitter_estimator.cc
@@ -23,6 +23,7 @@
#include "rtc_base/experiments/jitter_upper_bound_experiment.h"
#include "rtc_base/numerics/safe_conversions.h"
#include "system_wrappers/include/clock.h"
+#include "system_wrappers/include/field_trial.h"
namespace webrtc {
namespace {
@@ -50,6 +51,8 @@
time_deviation_upper_bound_(
JitterUpperBoundExperiment::GetUpperBoundSigmas().value_or(
kDefaultMaxTimestampDeviationInSigmas)),
+ enable_reduced_delay_(
+ !field_trial::IsEnabled("WebRTC-ReducedJitterDelayKillSwitch")),
clock_(clock) {
Reset();
}
@@ -395,22 +398,25 @@
}
}
- static const double kJitterScaleLowThreshold = 5.0;
- static const double kJitterScaleHighThreshold = 10.0;
- double fps = GetFrameRate();
- // Ignore jitter for very low fps streams.
- if (fps < kJitterScaleLowThreshold) {
- if (fps == 0.0) {
- return rtc::checked_cast<int>(std::max(0.0, jitterMS) + 0.5);
+ if (enable_reduced_delay_) {
+ static const double kJitterScaleLowThreshold = 5.0;
+ static const double kJitterScaleHighThreshold = 10.0;
+ double fps = GetFrameRate();
+ // Ignore jitter for very low fps streams.
+ if (fps < kJitterScaleLowThreshold) {
+ if (fps == 0.0) {
+ return rtc::checked_cast<int>(std::max(0.0, jitterMS) + 0.5);
+ }
+ return 0;
}
- return 0;
- }
- // Semi-low frame rate; scale by factor linearly interpolated from 0.0 at
- // kJitterScaleLowThreshold to 1.0 at kJitterScaleHighThreshold.
- if (fps < kJitterScaleHighThreshold) {
- jitterMS = (1.0 / (kJitterScaleHighThreshold - kJitterScaleLowThreshold)) *
- (fps - kJitterScaleLowThreshold) * jitterMS;
+ // Semi-low frame rate; scale by factor linearly interpolated from 0.0 at
+ // kJitterScaleLowThreshold to 1.0 at kJitterScaleHighThreshold.
+ if (fps < kJitterScaleHighThreshold) {
+ jitterMS =
+ (1.0 / (kJitterScaleHighThreshold - kJitterScaleLowThreshold)) *
+ (fps - kJitterScaleLowThreshold) * jitterMS;
+ }
}
return rtc::checked_cast<int>(std::max(0.0, jitterMS) + 0.5);
diff --git a/modules/video_coding/jitter_estimator.h b/modules/video_coding/jitter_estimator.h
index d9798b4..1d69b95 100644
--- a/modules/video_coding/jitter_estimator.h
+++ b/modules/video_coding/jitter_estimator.h
@@ -150,6 +150,7 @@
rtc::RollingAccumulator<uint64_t> fps_counter_;
const double time_deviation_upper_bound_;
+ const bool enable_reduced_delay_;
Clock* clock_;
};
diff --git a/modules/video_coding/jitter_estimator_tests.cc b/modules/video_coding/jitter_estimator_tests.cc
index 1ad9abb..14baae7 100644
--- a/modules/video_coding/jitter_estimator_tests.cc
+++ b/modules/video_coding/jitter_estimator_tests.cc
@@ -72,6 +72,22 @@
}
}
+TEST_F(TestVCMJitterEstimator, TestLowRateDisabled) {
+ test::ScopedFieldTrials field_trials(
+ "WebRTC-ReducedJitterDelayKillSwitch/Enabled/");
+ SetUp();
+
+ ValueGenerator gen(10);
+ uint64_t time_delta_us = rtc::kNumMicrosecsPerSec / 5;
+ for (int i = 0; i < 60; ++i) {
+ estimator_->UpdateEstimate(gen.Delay(), gen.FrameSize());
+ AdvanceClock(time_delta_us);
+ if (i > 2)
+ EXPECT_GT(estimator_->GetJitterEstimate(0, absl::nullopt), 0);
+ gen.Advance();
+ }
+}
+
TEST_F(TestVCMJitterEstimator, TestUpperBound) {
struct TestContext {
TestContext()