blob: 2f19a1c53fa49f79ee12e14ea7e325523748e701 [file] [log] [blame]
Rasmus Brandt3dde4502019-03-21 11:46:17 +01001/*
2 * Copyright (c) 2019 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/keyframe_interval_settings.h"
12
13#include "api/transport/field_trial_based_config.h"
14
15namespace webrtc {
16
17namespace {
18
19constexpr char kFieldTrialName[] = "WebRTC-KeyframeInterval";
20
21} // namespace
22
23KeyframeIntervalSettings::KeyframeIntervalSettings(
24 const WebRtcKeyValueConfig* const key_value_config)
25 : min_keyframe_send_interval_ms_("min_keyframe_send_interval_ms"),
26 max_wait_for_keyframe_ms_("max_wait_for_keyframe_ms"),
27 max_wait_for_frame_ms_("max_wait_for_frame_ms") {
28 ParseFieldTrial({&min_keyframe_send_interval_ms_, &max_wait_for_keyframe_ms_,
29 &max_wait_for_frame_ms_},
30 key_value_config->Lookup(kFieldTrialName));
31}
32
33KeyframeIntervalSettings KeyframeIntervalSettings::ParseFromFieldTrials() {
34 FieldTrialBasedConfig field_trial_config;
35 return KeyframeIntervalSettings(&field_trial_config);
36}
37
38absl::optional<int> KeyframeIntervalSettings::MinKeyframeSendIntervalMs()
39 const {
40 return min_keyframe_send_interval_ms_.GetOptional();
41}
42
43absl::optional<int> KeyframeIntervalSettings::MaxWaitForKeyframeMs() const {
44 return max_wait_for_keyframe_ms_.GetOptional();
45}
46
47absl::optional<int> KeyframeIntervalSettings::MaxWaitForFrameMs() const {
48 return max_wait_for_frame_ms_.GetOptional();
49}
50
51} // namespace webrtc