Revert "Make relative arrival delay mode default in NetEq delay manager."
This reverts commit 77c71d1488b1c821b2b3481f23a3264f1b1d37a5. Reason for revert: breaking downstream projects Original change's description: > Make relative arrival delay mode default in NetEq delay manager. > > Bug: webrtc:10333 > Change-Id: I9b1e0bec0b1813cf31259492f83eb2ca86a44d3f > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150782 > Reviewed-by: Sebastian Jansson <srte@webrtc.org> > Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org> > Reviewed-by: Minyue Li <minyue@webrtc.org> > Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#29075} TBR=henrik.lundin@webrtc.org,srte@webrtc.org,minyue@webrtc.org,jakobi@webrtc.org Change-Id: I67c5b9c7a6e854d3aac379aa4d98bfeb5425d312 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:10333 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151642 Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29078}
This commit is contained in:
committed by
Commit Bot
parent
8dcbdd2f90
commit
5b728cca77
@ -31,8 +31,11 @@
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr int kLimitProbability = 1020054733; // 19/20 in Q30.
|
||||
constexpr int kMinBaseMinimumDelayMs = 0;
|
||||
constexpr int kMaxBaseMinimumDelayMs = 10000;
|
||||
constexpr int kIatFactor = 32745; // 0.9993 in Q15.
|
||||
constexpr int kMaxIat = 64; // Max inter-arrival time to register.
|
||||
constexpr int kMaxReorderedPackets =
|
||||
10; // Max number of consecutive reordered packets.
|
||||
constexpr int kMaxHistoryMs = 2000; // Oldest packet to include in history to
|
||||
@ -44,19 +47,43 @@ int PercentileToQuantile(double percentile) {
|
||||
return static_cast<int>((1 << 30) * percentile / 100.0 + 0.5);
|
||||
}
|
||||
|
||||
absl::optional<int> GetForcedLimitProbability() {
|
||||
constexpr char kForceTargetDelayPercentileFieldTrial[] =
|
||||
"WebRTC-Audio-NetEqForceTargetDelayPercentile";
|
||||
const bool use_forced_target_delay_percentile =
|
||||
webrtc::field_trial::IsEnabled(kForceTargetDelayPercentileFieldTrial);
|
||||
if (use_forced_target_delay_percentile) {
|
||||
const std::string field_trial_string = webrtc::field_trial::FindFullName(
|
||||
kForceTargetDelayPercentileFieldTrial);
|
||||
double percentile = -1.0;
|
||||
if (sscanf(field_trial_string.c_str(), "Enabled-%lf", &percentile) == 1 &&
|
||||
percentile >= 0.0 && percentile <= 100.0) {
|
||||
return absl::make_optional<int>(
|
||||
PercentileToQuantile(percentile)); // in Q30.
|
||||
} else {
|
||||
RTC_LOG(LS_WARNING) << "Invalid parameter for "
|
||||
<< kForceTargetDelayPercentileFieldTrial
|
||||
<< ", ignored.";
|
||||
}
|
||||
}
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
struct DelayHistogramConfig {
|
||||
int quantile = 1041529569; // 0.97 in Q30.
|
||||
int quantile = 1020054733; // 0.95 in Q30.
|
||||
int forget_factor = 32745; // 0.9993 in Q15.
|
||||
absl::optional<double> start_forget_weight = 2;
|
||||
absl::optional<double> start_forget_weight;
|
||||
};
|
||||
|
||||
DelayHistogramConfig GetDelayHistogramConfig() {
|
||||
absl::optional<DelayHistogramConfig> GetDelayHistogramConfig() {
|
||||
constexpr char kDelayHistogramFieldTrial[] =
|
||||
"WebRTC-Audio-NetEqDelayHistogram";
|
||||
DelayHistogramConfig config;
|
||||
if (webrtc::field_trial::IsEnabled(kDelayHistogramFieldTrial)) {
|
||||
const bool use_new_delay_manager =
|
||||
webrtc::field_trial::IsEnabled(kDelayHistogramFieldTrial);
|
||||
if (use_new_delay_manager) {
|
||||
const auto field_trial_string =
|
||||
webrtc::field_trial::FindFullName(kDelayHistogramFieldTrial);
|
||||
DelayHistogramConfig config;
|
||||
double percentile = -1.0;
|
||||
double forget_factor = -1.0;
|
||||
double start_forget_weight = -1.0;
|
||||
@ -66,17 +93,18 @@ DelayHistogramConfig GetDelayHistogramConfig() {
|
||||
forget_factor <= 1.0) {
|
||||
config.quantile = PercentileToQuantile(percentile);
|
||||
config.forget_factor = (1 << 15) * forget_factor;
|
||||
config.start_forget_weight =
|
||||
start_forget_weight >= 1 ? absl::make_optional(start_forget_weight)
|
||||
: absl::nullopt;
|
||||
if (start_forget_weight >= 1) {
|
||||
config.start_forget_weight = start_forget_weight;
|
||||
}
|
||||
}
|
||||
RTC_LOG(LS_INFO) << "Delay histogram config:"
|
||||
<< " quantile=" << config.quantile
|
||||
<< " forget_factor=" << config.forget_factor
|
||||
<< " start_forget_weight="
|
||||
<< config.start_forget_weight.value_or(0);
|
||||
return absl::make_optional(config);
|
||||
}
|
||||
RTC_LOG(LS_INFO) << "Delay histogram config:"
|
||||
<< " quantile=" << config.quantile
|
||||
<< " forget_factor=" << config.forget_factor
|
||||
<< " start_forget_weight="
|
||||
<< config.start_forget_weight.value_or(0);
|
||||
return config;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
absl::optional<int> GetDecelerationTargetLevelOffsetMs() {
|
||||
@ -172,11 +200,21 @@ std::unique_ptr<DelayManager> DelayManager::Create(
|
||||
DelayPeakDetector* peak_detector,
|
||||
const TickTimer* tick_timer,
|
||||
StatisticsCalculator* statistics) {
|
||||
const HistogramMode mode = RELATIVE_ARRIVAL_DELAY;
|
||||
DelayHistogramConfig config = GetDelayHistogramConfig();
|
||||
const int quantile = config.quantile;
|
||||
std::unique_ptr<Histogram> histogram = absl::make_unique<Histogram>(
|
||||
kDelayBuckets, config.forget_factor, config.start_forget_weight);
|
||||
int quantile;
|
||||
std::unique_ptr<Histogram> histogram;
|
||||
HistogramMode mode;
|
||||
auto delay_histogram_config = GetDelayHistogramConfig();
|
||||
if (delay_histogram_config) {
|
||||
DelayHistogramConfig config = delay_histogram_config.value();
|
||||
quantile = config.quantile;
|
||||
histogram = absl::make_unique<Histogram>(
|
||||
kDelayBuckets, config.forget_factor, config.start_forget_weight);
|
||||
mode = RELATIVE_ARRIVAL_DELAY;
|
||||
} else {
|
||||
quantile = GetForcedLimitProbability().value_or(kLimitProbability);
|
||||
histogram = absl::make_unique<Histogram>(kMaxIat + 1, kIatFactor);
|
||||
mode = INTER_ARRIVAL_TIME;
|
||||
}
|
||||
return absl::make_unique<DelayManager>(
|
||||
max_packets_in_buffer, base_minimum_delay_ms, quantile, mode,
|
||||
enable_rtx_handling, peak_detector, tick_timer, statistics,
|
||||
|
||||
Reference in New Issue
Block a user