blob: 84a17bf18221056fe6cfd4dbb68576a1447a4c69 [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>
Erik Språngb1e031a2018-11-01 11:20:49 +010014#include <string>
15
16#include "rtc_base/logging.h"
17#include "system_wrappers/include/field_trial.h"
18
19namespace webrtc {
20
21const char JitterUpperBoundExperiment::kJitterUpperBoundExperimentName[] =
22 "WebRTC-JitterUpperBound";
23
24absl::optional<double> JitterUpperBoundExperiment::GetUpperBoundSigmas() {
25 if (!field_trial::IsEnabled(kJitterUpperBoundExperimentName)) {
26 return absl::nullopt;
27 }
28 const std::string group =
29 webrtc::field_trial::FindFullName(kJitterUpperBoundExperimentName);
30
31 double upper_bound_sigmas;
32 if (sscanf(group.c_str(), "Enabled-%lf", &upper_bound_sigmas) != 1) {
33 RTC_LOG(LS_WARNING) << "Invalid number of parameters provided.";
34 return absl::nullopt;
35 }
36
37 if (upper_bound_sigmas < 0) {
38 RTC_LOG(LS_WARNING) << "Invalid jitter upper bound sigmas, must be >= 0.0: "
39 << upper_bound_sigmas;
40 return absl::nullopt;
41 }
42
43 return upper_bound_sigmas;
44}
45
46} // namespace webrtc