blob: 114303e6169a55510adfa1d1884a260aef99f092 [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
sprang@webrtc.orgccd42842014-01-07 09:54:34 +000019#include "webrtc/common_types.h"
pbos@webrtc.orgce90eff2013-11-20 11:48:56 +000020#include "webrtc/typedefs.h"
21
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000022namespace webrtc {
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000023
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000024// Settings for NACK, see RFC 4585 for details.
25struct NackConfig {
pbos@webrtc.orgeceb5322013-05-28 08:04:45 +000026 NackConfig() : rtp_history_ms(0) {}
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000027 // 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.orgeceb5322013-05-28 08:04:45 +000030 // Set to '0' to disable.
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000031 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.
36struct FecConfig {
Shao Changbine62202f2015-04-21 20:24:50 +080037 FecConfig()
38 : ulpfec_payload_type(-1),
39 red_payload_type(-1),
40 red_rtx_payload_type(-1) {}
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000041 std::string ToString() const;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000042 // 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 Changbine62202f2015-04-21 20:24:50 +080047
48 // RTX payload type for RED payload.
49 int red_rtx_payload_type;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000050};
51
solenberg3a941542015-11-16 07:34:50 -080052// RTP header extension, see RFC 5285.
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000053struct RtpExtension {
pbos@webrtc.org3c107582014-07-20 15:27:35 +000054 RtpExtension(const std::string& name, int id) : name(name), id(id) {}
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000055 std::string ToString() const;
solenberg3a941542015-11-16 07:34:50 -080056 bool operator==(const RtpExtension& rhs) const {
57 return name == rhs.name && id == rhs.id;
58 }
Fredrik Solenberg23fba1f2015-04-29 15:24:01 +020059 static bool IsSupportedForAudio(const std::string& name);
60 static bool IsSupportedForVideo(const std::string& name);
pbos@webrtc.org3c107582014-07-20 15:27:35 +000061
pbos@webrtc.orgce90eff2013-11-20 11:48:56 +000062 static const char* kTOffset;
63 static const char* kAbsSendTime;
guoweis@webrtc.orgfdd10572015-03-12 20:50:57 +000064 static const char* kVideoRotation;
Fredrik Solenberg23fba1f2015-04-29 15:24:01 +020065 static const char* kAudioLevel;
sprang867fb522015-08-03 04:38:41 -070066 static const char* kTransportSequenceNumber;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000067 std::string name;
68 int id;
69};
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000070
71struct VideoStream {
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +000072 VideoStream();
73 ~VideoStream();
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000074 std::string ToString() const;
75
76 size_t width;
77 size_t height;
78 int max_framerate;
79
80 int min_bitrate_bps;
81 int target_bitrate_bps;
82 int max_bitrate_bps;
83
84 int max_qp;
85
pbos@webrtc.orgb7ed7792014-10-31 13:08:10 +000086 // Bitrate thresholds for enabling additional temporal layers. Since these are
87 // thresholds in between layers, we have one additional layer. One threshold
88 // gives two temporal layers, one below the threshold and one above, two give
89 // three, and so on.
90 // The VideoEncoder may redistribute bitrates over the temporal layers so a
91 // bitrate threshold of 100k and an estimate of 105k does not imply that we
92 // get 100k in one temporal layer and 5k in the other, just that the bitrate
93 // in the first temporal layer should not exceed 100k.
94 // TODO(pbos): Apart from a special case for two-layer screencast these
95 // thresholds are not propagated to the VideoEncoder. To be implemented.
96 std::vector<int> temporal_layer_thresholds_bps;
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000097};
98
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +000099struct VideoEncoderConfig {
Erik Språng143cec12015-04-28 10:01:41 +0200100 enum class ContentType {
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000101 kRealtimeVideo,
Erik Språng143cec12015-04-28 10:01:41 +0200102 kScreen,
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000103 };
104
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +0000105 VideoEncoderConfig();
106 ~VideoEncoderConfig();
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000107 std::string ToString() const;
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000108
109 std::vector<VideoStream> streams;
sprangce4aef12015-11-02 07:23:20 -0800110 std::vector<SpatialLayer> spatial_layers;
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000111 ContentType content_type;
112 void* encoder_specific_settings;
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000113
114 // Padding will be used up to this bitrate regardless of the bitrate produced
115 // by the encoder. Padding above what's actually produced by the encoder helps
116 // maintaining a higher bitrate estimate. Padding will however not be sent
117 // unless the estimated bandwidth indicates that the link can handle it.
118 int min_transmit_bitrate_bps;
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000119};
120
Henrik Lundin64dad832015-05-11 12:44:23 +0200121// Controls the capacity of the packet buffer in NetEq. The capacity is the
122// maximum number of packets that the buffer can contain. If the limit is
123// exceeded, the buffer will be flushed. The capacity does not affect the actual
124// audio delay in the general case, since this is governed by the target buffer
125// level (calculated from the jitter profile). It is only in the rare case of
126// severe network freezes that a higher capacity will lead to a (transient)
127// increase in audio delay.
128struct NetEqCapacityConfig {
129 NetEqCapacityConfig() : enabled(false), capacity(0) {}
130 explicit NetEqCapacityConfig(int value) : enabled(true), capacity(value) {}
131 bool enabled;
132 int capacity;
133};
134
Henrik Lundin5263b3c2015-06-01 10:29:41 +0200135struct NetEqFastAccelerate {
136 NetEqFastAccelerate() : enabled(false) {}
137 explicit NetEqFastAccelerate(bool value) : enabled(value) {}
138 bool enabled;
139};
140
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +0000141} // namespace webrtc
142
pbos@webrtc.org3c107582014-07-20 15:27:35 +0000143#endif // WEBRTC_CONFIG_H_