mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 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 | |
pbos@webrtc.org | 16e03b7 | 2013-10-28 16:32:01 +0000 | [diff] [blame] | 11 | // TODO(pbos): Move Config from common.h to here. |
| 12 | |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 13 | #ifndef WEBRTC_CONFIG_H_ |
| 14 | #define WEBRTC_CONFIG_H_ |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 15 | |
| 16 | #include <string> |
pbos@webrtc.org | 5860de0 | 2013-09-16 13:01:47 +0000 | [diff] [blame] | 17 | #include <vector> |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 18 | |
johan | 3859c89 | 2016-08-05 09:19:25 -0700 | [diff] [blame^] | 19 | #include "webrtc/base/optional.h" |
aluebs | 688e308 | 2016-01-14 04:32:46 -0800 | [diff] [blame] | 20 | #include "webrtc/common.h" |
sprang@webrtc.org | ccd4284 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 21 | #include "webrtc/common_types.h" |
pbos@webrtc.org | ce90eff | 2013-11-20 11:48:56 +0000 | [diff] [blame] | 22 | #include "webrtc/typedefs.h" |
| 23 | |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 24 | namespace webrtc { |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 25 | |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 26 | // Settings for NACK, see RFC 4585 for details. |
| 27 | struct NackConfig { |
pbos@webrtc.org | eceb532 | 2013-05-28 08:04:45 +0000 | [diff] [blame] | 28 | NackConfig() : rtp_history_ms(0) {} |
solenberg | 971cab0 | 2016-06-14 10:02:41 -0700 | [diff] [blame] | 29 | std::string ToString() const; |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 30 | // Send side: the time RTP packets are stored for retransmissions. |
| 31 | // Receive side: the time the receiver is prepared to wait for |
| 32 | // retransmissions. |
pbos@webrtc.org | eceb532 | 2013-05-28 08:04:45 +0000 | [diff] [blame] | 33 | // Set to '0' to disable. |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 34 | int rtp_history_ms; |
| 35 | }; |
| 36 | |
| 37 | // Settings for forward error correction, see RFC 5109 for details. Set the |
| 38 | // payload types to '-1' to disable. |
| 39 | struct FecConfig { |
Shao Changbin | e62202f | 2015-04-21 20:24:50 +0800 | [diff] [blame] | 40 | FecConfig() |
| 41 | : ulpfec_payload_type(-1), |
| 42 | red_payload_type(-1), |
| 43 | red_rtx_payload_type(-1) {} |
pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 44 | std::string ToString() const; |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 45 | // Payload type used for ULPFEC packets. |
| 46 | int ulpfec_payload_type; |
| 47 | |
| 48 | // Payload type used for RED packets. |
| 49 | int red_payload_type; |
Shao Changbin | e62202f | 2015-04-21 20:24:50 +0800 | [diff] [blame] | 50 | |
| 51 | // RTX payload type for RED payload. |
| 52 | int red_rtx_payload_type; |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 53 | }; |
| 54 | |
solenberg | 3a94154 | 2015-11-16 07:34:50 -0800 | [diff] [blame] | 55 | // RTP header extension, see RFC 5285. |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 56 | struct RtpExtension { |
isheriff | 6f8d686 | 2016-05-26 11:24:55 -0700 | [diff] [blame] | 57 | RtpExtension() : id(0) {} |
| 58 | RtpExtension(const std::string& uri, int id) : uri(uri), id(id) {} |
pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 59 | std::string ToString() const; |
solenberg | 3a94154 | 2015-11-16 07:34:50 -0800 | [diff] [blame] | 60 | bool operator==(const RtpExtension& rhs) const { |
isheriff | 6f8d686 | 2016-05-26 11:24:55 -0700 | [diff] [blame] | 61 | return uri == rhs.uri && id == rhs.id; |
solenberg | 3a94154 | 2015-11-16 07:34:50 -0800 | [diff] [blame] | 62 | } |
isheriff | 6f8d686 | 2016-05-26 11:24:55 -0700 | [diff] [blame] | 63 | static bool IsSupportedForAudio(const std::string& uri); |
| 64 | static bool IsSupportedForVideo(const std::string& uri); |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 65 | |
isheriff | 6f8d686 | 2016-05-26 11:24:55 -0700 | [diff] [blame] | 66 | // Header extension for audio levels, as defined in: |
| 67 | // http://tools.ietf.org/html/draft-ietf-avtext-client-to-mixer-audio-level-03 |
| 68 | static const char* kAudioLevelUri; |
| 69 | static const int kAudioLevelDefaultId; |
| 70 | |
| 71 | // Header extension for RTP timestamp offset, see RFC 5450 for details: |
| 72 | // http://tools.ietf.org/html/rfc5450 |
| 73 | static const char* kTimestampOffsetUri; |
| 74 | static const int kTimestampOffsetDefaultId; |
| 75 | |
| 76 | // Header extension for absolute send time, see url for details: |
| 77 | // http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time |
| 78 | static const char* kAbsSendTimeUri; |
| 79 | static const int kAbsSendTimeDefaultId; |
| 80 | |
| 81 | // Header extension for coordination of video orientation, see url for |
| 82 | // details: |
| 83 | // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ts_126114v120700p.pdf |
| 84 | static const char* kVideoRotationUri; |
| 85 | static const int kVideoRotationDefaultId; |
| 86 | |
| 87 | // Header extension for transport sequence number, see url for details: |
| 88 | // http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions |
| 89 | static const char* kTransportSequenceNumberUri; |
| 90 | static const int kTransportSequenceNumberDefaultId; |
| 91 | |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 92 | static const char* kPlayoutDelayUri; |
| 93 | static const int kPlayoutDelayDefaultId; |
| 94 | |
isheriff | 6f8d686 | 2016-05-26 11:24:55 -0700 | [diff] [blame] | 95 | std::string uri; |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 96 | int id; |
| 97 | }; |
pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 98 | |
| 99 | struct VideoStream { |
kwiberg@webrtc.org | ac2d27d | 2015-02-26 13:59:22 +0000 | [diff] [blame] | 100 | VideoStream(); |
| 101 | ~VideoStream(); |
pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 102 | std::string ToString() const; |
| 103 | |
| 104 | size_t width; |
| 105 | size_t height; |
| 106 | int max_framerate; |
| 107 | |
| 108 | int min_bitrate_bps; |
| 109 | int target_bitrate_bps; |
| 110 | int max_bitrate_bps; |
| 111 | |
| 112 | int max_qp; |
| 113 | |
pbos@webrtc.org | b7ed779 | 2014-10-31 13:08:10 +0000 | [diff] [blame] | 114 | // Bitrate thresholds for enabling additional temporal layers. Since these are |
| 115 | // thresholds in between layers, we have one additional layer. One threshold |
| 116 | // gives two temporal layers, one below the threshold and one above, two give |
| 117 | // three, and so on. |
| 118 | // The VideoEncoder may redistribute bitrates over the temporal layers so a |
| 119 | // bitrate threshold of 100k and an estimate of 105k does not imply that we |
| 120 | // get 100k in one temporal layer and 5k in the other, just that the bitrate |
| 121 | // in the first temporal layer should not exceed 100k. |
| 122 | // TODO(pbos): Apart from a special case for two-layer screencast these |
| 123 | // thresholds are not propagated to the VideoEncoder. To be implemented. |
| 124 | std::vector<int> temporal_layer_thresholds_bps; |
pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 125 | }; |
| 126 | |
pbos@webrtc.org | bbe0a85 | 2014-09-19 12:30:25 +0000 | [diff] [blame] | 127 | struct VideoEncoderConfig { |
Erik Språng | 143cec1 | 2015-04-28 10:01:41 +0200 | [diff] [blame] | 128 | enum class ContentType { |
pbos@webrtc.org | bbe0a85 | 2014-09-19 12:30:25 +0000 | [diff] [blame] | 129 | kRealtimeVideo, |
Erik Språng | 143cec1 | 2015-04-28 10:01:41 +0200 | [diff] [blame] | 130 | kScreen, |
pbos@webrtc.org | bbe0a85 | 2014-09-19 12:30:25 +0000 | [diff] [blame] | 131 | }; |
| 132 | |
kwiberg@webrtc.org | ac2d27d | 2015-02-26 13:59:22 +0000 | [diff] [blame] | 133 | VideoEncoderConfig(); |
| 134 | ~VideoEncoderConfig(); |
pbos@webrtc.org | ad3b5a5 | 2014-10-24 09:23:21 +0000 | [diff] [blame] | 135 | std::string ToString() const; |
pbos@webrtc.org | bbe0a85 | 2014-09-19 12:30:25 +0000 | [diff] [blame] | 136 | |
| 137 | std::vector<VideoStream> streams; |
sprang | ce4aef1 | 2015-11-02 07:23:20 -0800 | [diff] [blame] | 138 | std::vector<SpatialLayer> spatial_layers; |
pbos@webrtc.org | bbe0a85 | 2014-09-19 12:30:25 +0000 | [diff] [blame] | 139 | ContentType content_type; |
| 140 | void* encoder_specific_settings; |
pbos@webrtc.org | ad3b5a5 | 2014-10-24 09:23:21 +0000 | [diff] [blame] | 141 | |
| 142 | // Padding will be used up to this bitrate regardless of the bitrate produced |
| 143 | // by the encoder. Padding above what's actually produced by the encoder helps |
| 144 | // maintaining a higher bitrate estimate. Padding will however not be sent |
| 145 | // unless the estimated bandwidth indicates that the link can handle it. |
| 146 | int min_transmit_bitrate_bps; |
skvlad | 3abb764 | 2016-06-16 12:08:03 -0700 | [diff] [blame] | 147 | bool expect_encode_from_texture; |
pbos@webrtc.org | bbe0a85 | 2014-09-19 12:30:25 +0000 | [diff] [blame] | 148 | }; |
| 149 | |
johan | 3859c89 | 2016-08-05 09:19:25 -0700 | [diff] [blame^] | 150 | struct VideoDecoderH264Settings { |
| 151 | std::string sprop_parameter_sets; |
| 152 | }; |
| 153 | |
| 154 | class DecoderSpecificSettings { |
| 155 | public: |
| 156 | virtual ~DecoderSpecificSettings() {} |
| 157 | rtc::Optional<VideoDecoderH264Settings> h264_extra_settings; |
| 158 | }; |
| 159 | |
Henrik Lundin | 64dad83 | 2015-05-11 12:44:23 +0200 | [diff] [blame] | 160 | // Controls the capacity of the packet buffer in NetEq. The capacity is the |
| 161 | // maximum number of packets that the buffer can contain. If the limit is |
| 162 | // exceeded, the buffer will be flushed. The capacity does not affect the actual |
| 163 | // audio delay in the general case, since this is governed by the target buffer |
| 164 | // level (calculated from the jitter profile). It is only in the rare case of |
| 165 | // severe network freezes that a higher capacity will lead to a (transient) |
| 166 | // increase in audio delay. |
| 167 | struct NetEqCapacityConfig { |
| 168 | NetEqCapacityConfig() : enabled(false), capacity(0) {} |
| 169 | explicit NetEqCapacityConfig(int value) : enabled(true), capacity(value) {} |
aluebs | 688e308 | 2016-01-14 04:32:46 -0800 | [diff] [blame] | 170 | static const ConfigOptionID identifier = ConfigOptionID::kNetEqCapacityConfig; |
Henrik Lundin | 64dad83 | 2015-05-11 12:44:23 +0200 | [diff] [blame] | 171 | bool enabled; |
| 172 | int capacity; |
| 173 | }; |
| 174 | |
Henrik Lundin | 5263b3c | 2015-06-01 10:29:41 +0200 | [diff] [blame] | 175 | struct NetEqFastAccelerate { |
| 176 | NetEqFastAccelerate() : enabled(false) {} |
| 177 | explicit NetEqFastAccelerate(bool value) : enabled(value) {} |
aluebs | 688e308 | 2016-01-14 04:32:46 -0800 | [diff] [blame] | 178 | static const ConfigOptionID identifier = ConfigOptionID::kNetEqFastAccelerate; |
Henrik Lundin | 5263b3c | 2015-06-01 10:29:41 +0200 | [diff] [blame] | 179 | bool enabled; |
| 180 | }; |
| 181 | |
Stefan Holmer | b86d4e4 | 2015-12-07 10:26:18 +0100 | [diff] [blame] | 182 | struct VoicePacing { |
| 183 | VoicePacing() : enabled(false) {} |
| 184 | explicit VoicePacing(bool value) : enabled(value) {} |
aluebs | 688e308 | 2016-01-14 04:32:46 -0800 | [diff] [blame] | 185 | static const ConfigOptionID identifier = ConfigOptionID::kVoicePacing; |
Stefan Holmer | b86d4e4 | 2015-12-07 10:26:18 +0100 | [diff] [blame] | 186 | bool enabled; |
| 187 | }; |
| 188 | |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 189 | } // namespace webrtc |
| 190 | |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 191 | #endif // WEBRTC_CONFIG_H_ |