Erik Språng | b1e031a | 2018-11-01 11:20:49 +0100 | [diff] [blame] | 1 | /* |
| 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 Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 13 | #include <stdio.h> |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 14 | |
Erik Språng | b1e031a | 2018-11-01 11:20:49 +0100 | [diff] [blame] | 15 | #include <string> |
| 16 | |
| 17 | #include "rtc_base/logging.h" |
| 18 | #include "system_wrappers/include/field_trial.h" |
| 19 | |
| 20 | namespace webrtc { |
| 21 | |
| 22 | const char JitterUpperBoundExperiment::kJitterUpperBoundExperimentName[] = |
| 23 | "WebRTC-JitterUpperBound"; |
| 24 | |
| 25 | absl::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 |