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