mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 | [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 | 24e2089 | 2013-10-28 16:32:01 | [diff] [blame] | 11 | // TODO(pbos): Move Config from common.h to here. |
| 12 | |
pbos@webrtc.org | f0a119f | 2014-07-20 15:27:35 | [diff] [blame] | 13 | #ifndef WEBRTC_CONFIG_H_ |
| 14 | #define WEBRTC_CONFIG_H_ |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 | [diff] [blame] | 15 | |
| 16 | #include <string> |
pbos@webrtc.org | 041d54b | 2013-09-16 13:01:47 | [diff] [blame] | 17 | #include <vector> |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 | [diff] [blame] | 18 | |
aluebs | bf4689d | 2016-01-14 12:32:46 | [diff] [blame] | 19 | #include "webrtc/common.h" |
sprang@webrtc.org | 49812e6 | 2014-01-07 09:54:34 | [diff] [blame] | 20 | #include "webrtc/common_types.h" |
pbos@webrtc.org | 346dbe7 | 2013-11-20 11:48:56 | [diff] [blame] | 21 | #include "webrtc/typedefs.h" |
| 22 | |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 | [diff] [blame] | 23 | namespace webrtc { |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 | [diff] [blame] | 24 | |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 | [diff] [blame] | 25 | // Settings for NACK, see RFC 4585 for details. |
| 26 | struct NackConfig { |
pbos@webrtc.org | b2d1a40 | 2013-05-28 08:04:45 | [diff] [blame] | 27 | NackConfig() : rtp_history_ms(0) {} |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 | [diff] [blame] | 28 | // Send side: the time RTP packets are stored for retransmissions. |
| 29 | // Receive side: the time the receiver is prepared to wait for |
| 30 | // retransmissions. |
pbos@webrtc.org | b2d1a40 | 2013-05-28 08:04:45 | [diff] [blame] | 31 | // Set to '0' to disable. |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 | [diff] [blame] | 32 | int rtp_history_ms; |
| 33 | }; |
| 34 | |
| 35 | // Settings for forward error correction, see RFC 5109 for details. Set the |
| 36 | // payload types to '-1' to disable. |
| 37 | struct FecConfig { |
Shao Changbin | 0f07171 | 2015-04-21 12:24:50 | [diff] [blame] | 38 | FecConfig() |
| 39 | : ulpfec_payload_type(-1), |
| 40 | red_payload_type(-1), |
| 41 | red_rtx_payload_type(-1) {} |
pbos@webrtc.org | 7e68693 | 2014-05-15 09:35:06 | [diff] [blame] | 42 | std::string ToString() const; |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 | [diff] [blame] | 43 | // Payload type used for ULPFEC packets. |
| 44 | int ulpfec_payload_type; |
| 45 | |
| 46 | // Payload type used for RED packets. |
| 47 | int red_payload_type; |
Shao Changbin | 0f07171 | 2015-04-21 12:24:50 | [diff] [blame] | 48 | |
| 49 | // RTX payload type for RED payload. |
| 50 | int red_rtx_payload_type; |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 | [diff] [blame] | 51 | }; |
| 52 | |
solenberg | ffe1ce0 | 2015-11-16 15:34:50 | [diff] [blame] | 53 | // RTP header extension, see RFC 5285. |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 | [diff] [blame] | 54 | struct RtpExtension { |
pbos@webrtc.org | f0a119f | 2014-07-20 15:27:35 | [diff] [blame] | 55 | RtpExtension(const std::string& name, int id) : name(name), id(id) {} |
pbos@webrtc.org | 7e68693 | 2014-05-15 09:35:06 | [diff] [blame] | 56 | std::string ToString() const; |
solenberg | ffe1ce0 | 2015-11-16 15:34:50 | [diff] [blame] | 57 | bool operator==(const RtpExtension& rhs) const { |
| 58 | return name == rhs.name && id == rhs.id; |
| 59 | } |
Fredrik Solenberg | ad86786 | 2015-04-29 13:24:01 | [diff] [blame] | 60 | static bool IsSupportedForAudio(const std::string& name); |
| 61 | static bool IsSupportedForVideo(const std::string& name); |
pbos@webrtc.org | f0a119f | 2014-07-20 15:27:35 | [diff] [blame] | 62 | |
pbos@webrtc.org | 346dbe7 | 2013-11-20 11:48:56 | [diff] [blame] | 63 | static const char* kTOffset; |
| 64 | static const char* kAbsSendTime; |
guoweis@webrtc.org | 42e1d11 | 2015-03-12 20:50:57 | [diff] [blame] | 65 | static const char* kVideoRotation; |
Fredrik Solenberg | ad86786 | 2015-04-29 13:24:01 | [diff] [blame] | 66 | static const char* kAudioLevel; |
sprang | 374a570 | 2015-08-03 11:38:41 | [diff] [blame] | 67 | static const char* kTransportSequenceNumber; |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 | [diff] [blame] | 68 | std::string name; |
| 69 | int id; |
| 70 | }; |
pbos@webrtc.org | 7e68693 | 2014-05-15 09:35:06 | [diff] [blame] | 71 | |
| 72 | struct VideoStream { |
kwiberg@webrtc.org | c4e2cd0 | 2015-02-26 13:59:22 | [diff] [blame] | 73 | VideoStream(); |
| 74 | ~VideoStream(); |
pbos@webrtc.org | 7e68693 | 2014-05-15 09:35:06 | [diff] [blame] | 75 | std::string ToString() const; |
| 76 | |
| 77 | size_t width; |
| 78 | size_t height; |
| 79 | int max_framerate; |
| 80 | |
| 81 | int min_bitrate_bps; |
| 82 | int target_bitrate_bps; |
| 83 | int max_bitrate_bps; |
| 84 | |
| 85 | int max_qp; |
| 86 | |
pbos@webrtc.org | ddb84aa | 2014-10-31 13:08:10 | [diff] [blame] | 87 | // Bitrate thresholds for enabling additional temporal layers. Since these are |
| 88 | // thresholds in between layers, we have one additional layer. One threshold |
| 89 | // gives two temporal layers, one below the threshold and one above, two give |
| 90 | // three, and so on. |
| 91 | // The VideoEncoder may redistribute bitrates over the temporal layers so a |
| 92 | // bitrate threshold of 100k and an estimate of 105k does not imply that we |
| 93 | // get 100k in one temporal layer and 5k in the other, just that the bitrate |
| 94 | // in the first temporal layer should not exceed 100k. |
| 95 | // TODO(pbos): Apart from a special case for two-layer screencast these |
| 96 | // thresholds are not propagated to the VideoEncoder. To be implemented. |
| 97 | std::vector<int> temporal_layer_thresholds_bps; |
pbos@webrtc.org | 7e68693 | 2014-05-15 09:35:06 | [diff] [blame] | 98 | }; |
| 99 | |
pbos@webrtc.org | 58b5140 | 2014-09-19 12:30:25 | [diff] [blame] | 100 | struct VideoEncoderConfig { |
Erik Språng | fc398fe | 2015-04-28 08:01:41 | [diff] [blame] | 101 | enum class ContentType { |
pbos@webrtc.org | 58b5140 | 2014-09-19 12:30:25 | [diff] [blame] | 102 | kRealtimeVideo, |
Erik Språng | fc398fe | 2015-04-28 08:01:41 | [diff] [blame] | 103 | kScreen, |
pbos@webrtc.org | 58b5140 | 2014-09-19 12:30:25 | [diff] [blame] | 104 | }; |
| 105 | |
kwiberg@webrtc.org | c4e2cd0 | 2015-02-26 13:59:22 | [diff] [blame] | 106 | VideoEncoderConfig(); |
| 107 | ~VideoEncoderConfig(); |
pbos@webrtc.org | 2366875 | 2014-10-24 09:23:21 | [diff] [blame] | 108 | std::string ToString() const; |
pbos@webrtc.org | 58b5140 | 2014-09-19 12:30:25 | [diff] [blame] | 109 | |
| 110 | std::vector<VideoStream> streams; |
sprang | 0ba16d1 | 2015-11-02 15:23:20 | [diff] [blame] | 111 | std::vector<SpatialLayer> spatial_layers; |
pbos@webrtc.org | 58b5140 | 2014-09-19 12:30:25 | [diff] [blame] | 112 | ContentType content_type; |
| 113 | void* encoder_specific_settings; |
pbos@webrtc.org | 2366875 | 2014-10-24 09:23:21 | [diff] [blame] | 114 | |
| 115 | // Padding will be used up to this bitrate regardless of the bitrate produced |
| 116 | // by the encoder. Padding above what's actually produced by the encoder helps |
| 117 | // maintaining a higher bitrate estimate. Padding will however not be sent |
| 118 | // unless the estimated bandwidth indicates that the link can handle it. |
| 119 | int min_transmit_bitrate_bps; |
pbos@webrtc.org | 58b5140 | 2014-09-19 12:30:25 | [diff] [blame] | 120 | }; |
| 121 | |
Henrik Lundin | 3780a57 | 2015-05-11 10:44:23 | [diff] [blame] | 122 | // Controls the capacity of the packet buffer in NetEq. The capacity is the |
| 123 | // maximum number of packets that the buffer can contain. If the limit is |
| 124 | // exceeded, the buffer will be flushed. The capacity does not affect the actual |
| 125 | // audio delay in the general case, since this is governed by the target buffer |
| 126 | // level (calculated from the jitter profile). It is only in the rare case of |
| 127 | // severe network freezes that a higher capacity will lead to a (transient) |
| 128 | // increase in audio delay. |
| 129 | struct NetEqCapacityConfig { |
| 130 | NetEqCapacityConfig() : enabled(false), capacity(0) {} |
| 131 | explicit NetEqCapacityConfig(int value) : enabled(true), capacity(value) {} |
aluebs | bf4689d | 2016-01-14 12:32:46 | [diff] [blame] | 132 | static const ConfigOptionID identifier = ConfigOptionID::kNetEqCapacityConfig; |
Henrik Lundin | 3780a57 | 2015-05-11 10:44:23 | [diff] [blame] | 133 | bool enabled; |
| 134 | int capacity; |
| 135 | }; |
| 136 | |
Henrik Lundin | 87b0c58 | 2015-06-01 08:29:41 | [diff] [blame] | 137 | struct NetEqFastAccelerate { |
| 138 | NetEqFastAccelerate() : enabled(false) {} |
| 139 | explicit NetEqFastAccelerate(bool value) : enabled(value) {} |
aluebs | bf4689d | 2016-01-14 12:32:46 | [diff] [blame] | 140 | static const ConfigOptionID identifier = ConfigOptionID::kNetEqFastAccelerate; |
Henrik Lundin | 87b0c58 | 2015-06-01 08:29:41 | [diff] [blame] | 141 | bool enabled; |
| 142 | }; |
| 143 | |
Stefan Holmer | f95302f | 2015-12-07 09:26:18 | [diff] [blame] | 144 | struct VoicePacing { |
| 145 | VoicePacing() : enabled(false) {} |
| 146 | explicit VoicePacing(bool value) : enabled(value) {} |
aluebs | bf4689d | 2016-01-14 12:32:46 | [diff] [blame] | 147 | static const ConfigOptionID identifier = ConfigOptionID::kVoicePacing; |
Stefan Holmer | f95302f | 2015-12-07 09:26:18 | [diff] [blame] | 148 | bool enabled; |
| 149 | }; |
| 150 | |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 | [diff] [blame] | 151 | } // namespace webrtc |
| 152 | |
pbos@webrtc.org | f0a119f | 2014-07-20 15:27:35 | [diff] [blame] | 153 | #endif // WEBRTC_CONFIG_H_ |