bitrate_settings.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) 2018 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 API_TRANSPORT_BITRATE_SETTINGS_H_
  11. #define API_TRANSPORT_BITRATE_SETTINGS_H_
  12. #include <algorithm>
  13. #include "absl/types/optional.h"
  14. #include "rtc_base/system/rtc_export.h"
  15. namespace webrtc {
  16. // Configuration of send bitrate. The |start_bitrate_bps| value is
  17. // used for multiple purposes, both as a prior in the bandwidth
  18. // estimator, and for initial configuration of the encoder. We may
  19. // want to create separate apis for those, and use a smaller struct
  20. // with only the min and max constraints.
  21. struct RTC_EXPORT BitrateSettings {
  22. BitrateSettings();
  23. ~BitrateSettings();
  24. BitrateSettings(const BitrateSettings&);
  25. // 0 <= min <= start <= max should hold for set parameters.
  26. absl::optional<int> min_bitrate_bps;
  27. absl::optional<int> start_bitrate_bps;
  28. absl::optional<int> max_bitrate_bps;
  29. };
  30. // TODO(srte): BitrateConstraints and BitrateSettings should be merged.
  31. // Both represent the same kind data, but are using different default
  32. // initializer and representation of unset values.
  33. struct BitrateConstraints {
  34. int min_bitrate_bps = 0;
  35. int start_bitrate_bps = kDefaultStartBitrateBps;
  36. int max_bitrate_bps = -1;
  37. private:
  38. static constexpr int kDefaultStartBitrateBps = 300000;
  39. };
  40. } // namespace webrtc
  41. #endif // API_TRANSPORT_BITRATE_SETTINGS_H_