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 #ifndef RTC_BASE_EXPERIMENTS_KEYFRAME_INTERVAL_SETTINGS_H_ 12 #define RTC_BASE_EXPERIMENTS_KEYFRAME_INTERVAL_SETTINGS_H_ 13 14 #include "absl/types/optional.h" 15 #include "api/transport/webrtc_key_value_config.h" 16 #include "rtc_base/experiments/field_trial_parser.h" 17 18 namespace webrtc { 19 20 class KeyframeIntervalSettings final { 21 public: 22 static KeyframeIntervalSettings ParseFromFieldTrials(); 23 24 // Sender side. 25 // The encoded keyframe send rate is <= 1/MinKeyframeSendIntervalMs(). 26 absl::optional<int> MinKeyframeSendIntervalMs() const; 27 28 // Receiver side. 29 // The keyframe request send rate is 30 // - when we have not received a key frame at all: 31 // <= 1/MaxWaitForKeyframeMs() 32 // - when we have not received a frame recently: 33 // <= 1/MaxWaitForFrameMs() 34 absl::optional<int> MaxWaitForKeyframeMs() const; 35 absl::optional<int> MaxWaitForFrameMs() const; 36 37 private: 38 explicit KeyframeIntervalSettings( 39 const WebRtcKeyValueConfig* key_value_config); 40 41 FieldTrialOptional<int> min_keyframe_send_interval_ms_; 42 FieldTrialOptional<int> max_wait_for_keyframe_ms_; 43 FieldTrialOptional<int> max_wait_for_frame_ms_; 44 }; 45 46 } // namespace webrtc 47 48 #endif // RTC_BASE_EXPERIMENTS_KEYFRAME_INTERVAL_SETTINGS_H_ 49