blob: ea95e84d15608b1671881cabec88f261e3a1586f [file] [log] [blame]
Erik Språngb1e031a2018-11-01 11:20:49 +01001/*
2 * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include "rtc_base/experiments/jitter_upper_bound_experiment.h"
12
Yves Gerey3e707812018-11-28 16:47:49 +010013#include <stdio.h>
Jonas Olssona4d87372019-07-05 19:08:33 +020014
Erik Språngb1e031a2018-11-01 11:20:49 +010015#include <string>
16
17#include "rtc_base/logging.h"
18#include "system_wrappers/include/field_trial.h"
19
20namespace webrtc {
21
22const char JitterUpperBoundExperiment::kJitterUpperBoundExperimentName[] =
23 "WebRTC-JitterUpperBound";
24
25absl::optional<double> JitterUpperBoundExperiment::GetUpperBoundSigmas() {
26 if (!field_trial::IsEnabled(kJitterUpperBoundExperimentName)) {
27 return absl::nullopt;
28 }
29 const std::string group =
30 webrtc::field_trial::FindFullName(kJitterUpperBoundExperimentName);
31
32 double upper_bound_sigmas;
33 if (sscanf(group.c_str(), "Enabled-%lf", &upper_bound_sigmas) != 1) {
34 RTC_LOG(LS_WARNING) << "Invalid number of parameters provided.";
35 return absl::nullopt;
36 }
37
38 if (upper_bound_sigmas < 0) {
39 RTC_LOG(LS_WARNING) << "Invalid jitter upper bound sigmas, must be >= 0.0: "
40 << upper_bound_sigmas;
41 return absl::nullopt;
42 }
43
44 return upper_bound_sigmas;
45}
46
47} // namespace webrtc