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