blob: 06460ae359641a533c7fdc4615e51637e72fb2ba [file] [log] [blame]
mflodman@webrtc.org06e80262013-04-18 12:02:521/*
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.org24e20892013-10-28 16:32:0111// TODO(pbos): Move Config from common.h to here.
12
pbos@webrtc.orgf0a119f2014-07-20 15:27:3513#ifndef WEBRTC_CONFIG_H_
14#define WEBRTC_CONFIG_H_
mflodman@webrtc.org06e80262013-04-18 12:02:5215
16#include <string>
pbos@webrtc.org041d54b2013-09-16 13:01:4717#include <vector>
mflodman@webrtc.org06e80262013-04-18 12:02:5218
aluebsbf4689d2016-01-14 12:32:4619#include "webrtc/common.h"
sprang@webrtc.org49812e62014-01-07 09:54:3420#include "webrtc/common_types.h"
pbos@webrtc.org346dbe72013-11-20 11:48:5621#include "webrtc/typedefs.h"
22
mflodman@webrtc.org06e80262013-04-18 12:02:5223namespace webrtc {
mflodman@webrtc.org06e80262013-04-18 12:02:5224
mflodman@webrtc.org06e80262013-04-18 12:02:5225// Settings for NACK, see RFC 4585 for details.
26struct NackConfig {
pbos@webrtc.orgb2d1a402013-05-28 08:04:4527 NackConfig() : rtp_history_ms(0) {}
mflodman@webrtc.org06e80262013-04-18 12:02:5228 // 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.orgb2d1a402013-05-28 08:04:4531 // Set to '0' to disable.
mflodman@webrtc.org06e80262013-04-18 12:02:5232 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 Changbin0f071712015-04-21 12:24:5038 FecConfig()
39 : ulpfec_payload_type(-1),
40 red_payload_type(-1),
41 red_rtx_payload_type(-1) {}
pbos@webrtc.org7e686932014-05-15 09:35:0642 std::string ToString() const;
mflodman@webrtc.org06e80262013-04-18 12:02:5243 // 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 Changbin0f071712015-04-21 12:24:5048
49 // RTX payload type for RED payload.
50 int red_rtx_payload_type;
mflodman@webrtc.org06e80262013-04-18 12:02:5251};
52
solenbergffe1ce02015-11-16 15:34:5053// RTP header extension, see RFC 5285.
mflodman@webrtc.org06e80262013-04-18 12:02:5254struct RtpExtension {
pbos@webrtc.orgf0a119f2014-07-20 15:27:3555 RtpExtension(const std::string& name, int id) : name(name), id(id) {}
pbos@webrtc.org7e686932014-05-15 09:35:0656 std::string ToString() const;
solenbergffe1ce02015-11-16 15:34:5057 bool operator==(const RtpExtension& rhs) const {
58 return name == rhs.name && id == rhs.id;
59 }
Fredrik Solenbergad867862015-04-29 13:24:0160 static bool IsSupportedForAudio(const std::string& name);
61 static bool IsSupportedForVideo(const std::string& name);
pbos@webrtc.orgf0a119f2014-07-20 15:27:3562
pbos@webrtc.org346dbe72013-11-20 11:48:5663 static const char* kTOffset;
64 static const char* kAbsSendTime;
guoweis@webrtc.org42e1d112015-03-12 20:50:5765 static const char* kVideoRotation;
Fredrik Solenbergad867862015-04-29 13:24:0166 static const char* kAudioLevel;
sprang374a5702015-08-03 11:38:4167 static const char* kTransportSequenceNumber;
mflodman@webrtc.org06e80262013-04-18 12:02:5268 std::string name;
69 int id;
70};
pbos@webrtc.org7e686932014-05-15 09:35:0671
72struct VideoStream {
kwiberg@webrtc.orgc4e2cd02015-02-26 13:59:2273 VideoStream();
74 ~VideoStream();
pbos@webrtc.org7e686932014-05-15 09:35:0675 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.orgddb84aa2014-10-31 13:08:1087 // 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.org7e686932014-05-15 09:35:0698};
99
pbos@webrtc.org58b51402014-09-19 12:30:25100struct VideoEncoderConfig {
Erik Språngfc398fe2015-04-28 08:01:41101 enum class ContentType {
pbos@webrtc.org58b51402014-09-19 12:30:25102 kRealtimeVideo,
Erik Språngfc398fe2015-04-28 08:01:41103 kScreen,
pbos@webrtc.org58b51402014-09-19 12:30:25104 };
105
kwiberg@webrtc.orgc4e2cd02015-02-26 13:59:22106 VideoEncoderConfig();
107 ~VideoEncoderConfig();
pbos@webrtc.org23668752014-10-24 09:23:21108 std::string ToString() const;
pbos@webrtc.org58b51402014-09-19 12:30:25109
110 std::vector<VideoStream> streams;
sprang0ba16d12015-11-02 15:23:20111 std::vector<SpatialLayer> spatial_layers;
pbos@webrtc.org58b51402014-09-19 12:30:25112 ContentType content_type;
113 void* encoder_specific_settings;
pbos@webrtc.org23668752014-10-24 09:23:21114
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.org58b51402014-09-19 12:30:25120};
121
Henrik Lundin3780a572015-05-11 10:44:23122// 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.
129struct NetEqCapacityConfig {
130 NetEqCapacityConfig() : enabled(false), capacity(0) {}
131 explicit NetEqCapacityConfig(int value) : enabled(true), capacity(value) {}
aluebsbf4689d2016-01-14 12:32:46132 static const ConfigOptionID identifier = ConfigOptionID::kNetEqCapacityConfig;
Henrik Lundin3780a572015-05-11 10:44:23133 bool enabled;
134 int capacity;
135};
136
Henrik Lundin87b0c582015-06-01 08:29:41137struct NetEqFastAccelerate {
138 NetEqFastAccelerate() : enabled(false) {}
139 explicit NetEqFastAccelerate(bool value) : enabled(value) {}
aluebsbf4689d2016-01-14 12:32:46140 static const ConfigOptionID identifier = ConfigOptionID::kNetEqFastAccelerate;
Henrik Lundin87b0c582015-06-01 08:29:41141 bool enabled;
142};
143
Stefan Holmerf95302f2015-12-07 09:26:18144struct VoicePacing {
145 VoicePacing() : enabled(false) {}
146 explicit VoicePacing(bool value) : enabled(value) {}
aluebsbf4689d2016-01-14 12:32:46147 static const ConfigOptionID identifier = ConfigOptionID::kVoicePacing;
Stefan Holmerf95302f2015-12-07 09:26:18148 bool enabled;
149};
150
mflodman@webrtc.org06e80262013-04-18 12:02:52151} // namespace webrtc
152
pbos@webrtc.orgf0a119f2014-07-20 15:27:35153#endif // WEBRTC_CONFIG_H_