blob: d5fd1fe564f6ea2b7d8d93f8b8280ebe27e221f0 [file] [log] [blame]
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +00001/*
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.org16e03b72013-10-28 16:32:01 +000011// TODO(pbos): Move Config from common.h to here.
12
pbos@webrtc.org3c107582014-07-20 15:27:35 +000013#ifndef WEBRTC_CONFIG_H_
14#define WEBRTC_CONFIG_H_
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000015
16#include <string>
pbos@webrtc.org5860de02013-09-16 13:01:47 +000017#include <vector>
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000018
aluebs688e3082016-01-14 04:32:46 -080019#include "webrtc/common.h"
sprang@webrtc.orgccd42842014-01-07 09:54:34 +000020#include "webrtc/common_types.h"
pbos@webrtc.orgce90eff2013-11-20 11:48:56 +000021#include "webrtc/typedefs.h"
22
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000023namespace webrtc {
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000024
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000025// Settings for NACK, see RFC 4585 for details.
26struct NackConfig {
pbos@webrtc.orgeceb5322013-05-28 08:04:45 +000027 NackConfig() : rtp_history_ms(0) {}
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000028 // 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.orgeceb5322013-05-28 08:04:45 +000031 // Set to '0' to disable.
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000032 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.
37struct FecConfig {
Shao Changbine62202f2015-04-21 20:24:50 +080038 FecConfig()
39 : ulpfec_payload_type(-1),
40 red_payload_type(-1),
41 red_rtx_payload_type(-1) {}
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000042 std::string ToString() const;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000043 // 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 Changbine62202f2015-04-21 20:24:50 +080048
49 // RTX payload type for RED payload.
50 int red_rtx_payload_type;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000051};
52
solenberg3a941542015-11-16 07:34:50 -080053// RTP header extension, see RFC 5285.
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000054struct RtpExtension {
isheriff6f8d6862016-05-26 11:24:55 -070055 RtpExtension() : id(0) {}
56 RtpExtension(const std::string& uri, int id) : uri(uri), id(id) {}
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000057 std::string ToString() const;
solenberg3a941542015-11-16 07:34:50 -080058 bool operator==(const RtpExtension& rhs) const {
isheriff6f8d6862016-05-26 11:24:55 -070059 return uri == rhs.uri && id == rhs.id;
solenberg3a941542015-11-16 07:34:50 -080060 }
isheriff6f8d6862016-05-26 11:24:55 -070061 static bool IsSupportedForAudio(const std::string& uri);
62 static bool IsSupportedForVideo(const std::string& uri);
pbos@webrtc.org3c107582014-07-20 15:27:35 +000063
isheriff6f8d6862016-05-26 11:24:55 -070064 // Header extension for audio levels, as defined in:
65 // http://tools.ietf.org/html/draft-ietf-avtext-client-to-mixer-audio-level-03
66 static const char* kAudioLevelUri;
67 static const int kAudioLevelDefaultId;
68
69 // Header extension for RTP timestamp offset, see RFC 5450 for details:
70 // http://tools.ietf.org/html/rfc5450
71 static const char* kTimestampOffsetUri;
72 static const int kTimestampOffsetDefaultId;
73
74 // Header extension for absolute send time, see url for details:
75 // http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
76 static const char* kAbsSendTimeUri;
77 static const int kAbsSendTimeDefaultId;
78
79 // Header extension for coordination of video orientation, see url for
80 // details:
81 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ts_126114v120700p.pdf
82 static const char* kVideoRotationUri;
83 static const int kVideoRotationDefaultId;
84
85 // Header extension for transport sequence number, see url for details:
86 // http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions
87 static const char* kTransportSequenceNumberUri;
88 static const int kTransportSequenceNumberDefaultId;
89
90 std::string uri;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000091 int id;
92};
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000093
94struct VideoStream {
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +000095 VideoStream();
96 ~VideoStream();
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000097 std::string ToString() const;
98
99 size_t width;
100 size_t height;
101 int max_framerate;
102
103 int min_bitrate_bps;
104 int target_bitrate_bps;
105 int max_bitrate_bps;
106
107 int max_qp;
108
pbos@webrtc.orgb7ed7792014-10-31 13:08:10 +0000109 // Bitrate thresholds for enabling additional temporal layers. Since these are
110 // thresholds in between layers, we have one additional layer. One threshold
111 // gives two temporal layers, one below the threshold and one above, two give
112 // three, and so on.
113 // The VideoEncoder may redistribute bitrates over the temporal layers so a
114 // bitrate threshold of 100k and an estimate of 105k does not imply that we
115 // get 100k in one temporal layer and 5k in the other, just that the bitrate
116 // in the first temporal layer should not exceed 100k.
117 // TODO(pbos): Apart from a special case for two-layer screencast these
118 // thresholds are not propagated to the VideoEncoder. To be implemented.
119 std::vector<int> temporal_layer_thresholds_bps;
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +0000120};
121
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000122struct VideoEncoderConfig {
Erik Språng143cec12015-04-28 10:01:41 +0200123 enum class ContentType {
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000124 kRealtimeVideo,
Erik Språng143cec12015-04-28 10:01:41 +0200125 kScreen,
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000126 };
127
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +0000128 VideoEncoderConfig();
129 ~VideoEncoderConfig();
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000130 std::string ToString() const;
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000131
132 std::vector<VideoStream> streams;
sprangce4aef12015-11-02 07:23:20 -0800133 std::vector<SpatialLayer> spatial_layers;
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000134 ContentType content_type;
135 void* encoder_specific_settings;
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000136
137 // Padding will be used up to this bitrate regardless of the bitrate produced
138 // by the encoder. Padding above what's actually produced by the encoder helps
139 // maintaining a higher bitrate estimate. Padding will however not be sent
140 // unless the estimated bandwidth indicates that the link can handle it.
141 int min_transmit_bitrate_bps;
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000142};
143
Henrik Lundin64dad832015-05-11 12:44:23 +0200144// Controls the capacity of the packet buffer in NetEq. The capacity is the
145// maximum number of packets that the buffer can contain. If the limit is
146// exceeded, the buffer will be flushed. The capacity does not affect the actual
147// audio delay in the general case, since this is governed by the target buffer
148// level (calculated from the jitter profile). It is only in the rare case of
149// severe network freezes that a higher capacity will lead to a (transient)
150// increase in audio delay.
151struct NetEqCapacityConfig {
152 NetEqCapacityConfig() : enabled(false), capacity(0) {}
153 explicit NetEqCapacityConfig(int value) : enabled(true), capacity(value) {}
aluebs688e3082016-01-14 04:32:46 -0800154 static const ConfigOptionID identifier = ConfigOptionID::kNetEqCapacityConfig;
Henrik Lundin64dad832015-05-11 12:44:23 +0200155 bool enabled;
156 int capacity;
157};
158
Henrik Lundin5263b3c2015-06-01 10:29:41 +0200159struct NetEqFastAccelerate {
160 NetEqFastAccelerate() : enabled(false) {}
161 explicit NetEqFastAccelerate(bool value) : enabled(value) {}
aluebs688e3082016-01-14 04:32:46 -0800162 static const ConfigOptionID identifier = ConfigOptionID::kNetEqFastAccelerate;
Henrik Lundin5263b3c2015-06-01 10:29:41 +0200163 bool enabled;
164};
165
Stefan Holmerb86d4e42015-12-07 10:26:18 +0100166struct VoicePacing {
167 VoicePacing() : enabled(false) {}
168 explicit VoicePacing(bool value) : enabled(value) {}
aluebs688e3082016-01-14 04:32:46 -0800169 static const ConfigOptionID identifier = ConfigOptionID::kVoicePacing;
Stefan Holmerb86d4e42015-12-07 10:26:18 +0100170 bool enabled;
171};
172
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +0000173} // namespace webrtc
174
pbos@webrtc.org3c107582014-07-20 15:27:35 +0000175#endif // WEBRTC_CONFIG_H_