Niels Möller | 0c4f7be | 2018-05-07 14:01:37 +0200 | [diff] [blame] | 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 | |
| 11 | #ifndef API_TRANSPORT_BITRATE_SETTINGS_H_ |
| 12 | #define API_TRANSPORT_BITRATE_SETTINGS_H_ |
| 13 | |
Mirko Bonadei | 738bfa7 | 2019-09-17 14:47:38 +0200 | [diff] [blame] | 14 | #include <algorithm> |
| 15 | |
Danil Chapovalov | 0bc58cf | 2018-06-21 13:32:56 +0200 | [diff] [blame] | 16 | #include "absl/types/optional.h" |
Mirko Bonadei | 66e7679 | 2019-04-02 11:33:59 +0200 | [diff] [blame] | 17 | #include "rtc_base/system/rtc_export.h" |
Niels Möller | 0c4f7be | 2018-05-07 14:01:37 +0200 | [diff] [blame] | 18 | |
| 19 | namespace webrtc { |
| 20 | |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame^] | 21 | // Configuration of send bitrate. The `start_bitrate_bps` value is |
Niels Möller | 0c4f7be | 2018-05-07 14:01:37 +0200 | [diff] [blame] | 22 | // used for multiple purposes, both as a prior in the bandwidth |
| 23 | // estimator, and for initial configuration of the encoder. We may |
| 24 | // want to create separate apis for those, and use a smaller struct |
| 25 | // with only the min and max constraints. |
Mirko Bonadei | 66e7679 | 2019-04-02 11:33:59 +0200 | [diff] [blame] | 26 | struct RTC_EXPORT BitrateSettings { |
Niels Möller | 0c4f7be | 2018-05-07 14:01:37 +0200 | [diff] [blame] | 27 | BitrateSettings(); |
| 28 | ~BitrateSettings(); |
| 29 | BitrateSettings(const BitrateSettings&); |
| 30 | // 0 <= min <= start <= max should hold for set parameters. |
Danil Chapovalov | 0bc58cf | 2018-06-21 13:32:56 +0200 | [diff] [blame] | 31 | absl::optional<int> min_bitrate_bps; |
| 32 | absl::optional<int> start_bitrate_bps; |
| 33 | absl::optional<int> max_bitrate_bps; |
Niels Möller | 0c4f7be | 2018-05-07 14:01:37 +0200 | [diff] [blame] | 34 | }; |
| 35 | |
Mirko Bonadei | 738bfa7 | 2019-09-17 14:47:38 +0200 | [diff] [blame] | 36 | // TODO(srte): BitrateConstraints and BitrateSettings should be merged. |
| 37 | // Both represent the same kind data, but are using different default |
| 38 | // initializer and representation of unset values. |
| 39 | struct BitrateConstraints { |
| 40 | int min_bitrate_bps = 0; |
| 41 | int start_bitrate_bps = kDefaultStartBitrateBps; |
| 42 | int max_bitrate_bps = -1; |
| 43 | |
| 44 | private: |
| 45 | static constexpr int kDefaultStartBitrateBps = 300000; |
| 46 | }; |
| 47 | |
Niels Möller | 0c4f7be | 2018-05-07 14:01:37 +0200 | [diff] [blame] | 48 | } // namespace webrtc |
| 49 | |
| 50 | #endif // API_TRANSPORT_BITRATE_SETTINGS_H_ |