blob: 0a9df493ed04c968a010c822ed253a28478a5e6e [file] [log] [blame]
Shuhai Pengf2707702021-09-29 09:19:441/*
2 * Copyright (c) 2021 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/bandwidth_quality_scaler_settings.h"
12
13#include "api/transport/field_trial_based_config.h"
14#include "rtc_base/logging.h"
15
16namespace webrtc {
17
18BandwidthQualityScalerSettings::BandwidthQualityScalerSettings(
Jonas Orelande62c2f22022-03-29 09:04:4819 const FieldTrialsView* const key_value_config)
Shuhai Pengf2707702021-09-29 09:19:4420 : bitrate_state_update_interval_s_("bitrate_state_update_interval_s_") {
21 ParseFieldTrial(
22 {&bitrate_state_update_interval_s_},
23 key_value_config->Lookup("WebRTC-Video-BandwidthQualityScalerSettings"));
24}
25
26BandwidthQualityScalerSettings
27BandwidthQualityScalerSettings::ParseFromFieldTrials() {
28 FieldTrialBasedConfig field_trial_config;
29 return BandwidthQualityScalerSettings(&field_trial_config);
30}
31
32absl::optional<uint32_t>
33BandwidthQualityScalerSettings::BitrateStateUpdateInterval() const {
34 if (bitrate_state_update_interval_s_ &&
35 bitrate_state_update_interval_s_.Value() <= 0) {
36 RTC_LOG(LS_WARNING)
37 << "Unsupported bitrate_state_update_interval_s_ value, ignored.";
38 return absl::nullopt;
39 }
40 return bitrate_state_update_interval_s_.GetOptional();
41}
42
43} // namespace webrtc