xref: /aosp_15_r20/external/webrtc/rtc_base/experiments/keyframe_interval_settings.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
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 
15 namespace webrtc {
16 
17 namespace {
18 
19 constexpr char kFieldTrialName[] = "WebRTC-KeyframeInterval";
20 
21 }  // namespace
22 
KeyframeIntervalSettings(const FieldTrialsView * const key_value_config)23 KeyframeIntervalSettings::KeyframeIntervalSettings(
24     const FieldTrialsView* const key_value_config)
25     : min_keyframe_send_interval_ms_("min_keyframe_send_interval_ms") {
26   ParseFieldTrial({&min_keyframe_send_interval_ms_},
27                   key_value_config->Lookup(kFieldTrialName));
28 }
29 
ParseFromFieldTrials()30 KeyframeIntervalSettings KeyframeIntervalSettings::ParseFromFieldTrials() {
31   FieldTrialBasedConfig field_trial_config;
32   return KeyframeIntervalSettings(&field_trial_config);
33 }
34 
MinKeyframeSendIntervalMs() const35 absl::optional<int> KeyframeIntervalSettings::MinKeyframeSendIntervalMs()
36     const {
37   return min_keyframe_send_interval_ms_.GetOptional();
38 }
39 }  // namespace webrtc
40