1 /* 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 16 namespace webrtc { 17 BandwidthQualityScalerSettings(const FieldTrialsView * const key_value_config)18BandwidthQualityScalerSettings::BandwidthQualityScalerSettings( 19 const FieldTrialsView* const key_value_config) 20 : 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 26 BandwidthQualityScalerSettings ParseFromFieldTrials()27BandwidthQualityScalerSettings::ParseFromFieldTrials() { 28 FieldTrialBasedConfig field_trial_config; 29 return BandwidthQualityScalerSettings(&field_trial_config); 30 } 31 32 absl::optional<uint32_t> BitrateStateUpdateInterval() const33BandwidthQualityScalerSettings::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 44