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}
This commit is contained in:
@ -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 @@ VCMJitterEstimator::VCMJitterEstimator(Clock* clock)
|
||||
time_deviation_upper_bound_(
|
||||
JitterUpperBoundExperiment::GetUpperBoundSigmas().value_or(
|
||||
kDefaultMaxTimestampDeviationInSigmas)),
|
||||
enable_reduced_delay_(
|
||||
!field_trial::IsEnabled("WebRTC-ReducedJitterDelayKillSwitch")),
|
||||
clock_(clock) {
|
||||
Reset();
|
||||
}
|
||||
@ -395,22 +398,25 @@ int VCMJitterEstimator::GetJitterEstimate(
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@ -150,6 +150,7 @@ class VCMJitterEstimator {
|
||||
|
||||
rtc::RollingAccumulator<uint64_t> fps_counter_;
|
||||
const double time_deviation_upper_bound_;
|
||||
const bool enable_reduced_delay_;
|
||||
Clock* clock_;
|
||||
};
|
||||
|
||||
|
||||
@ -72,6 +72,22 @@ TEST_F(TestVCMJitterEstimator, TestLowRate) {
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user