keyframe_interval_settings.h 1.6 KB

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