blob: ee1097fc31dc1f9e30ffb80259e1cebf391b8606 [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 +000024struct RtpStatistics {
pbos@webrtc.orgeceb5322013-05-28 08:04:45 +000025 RtpStatistics()
26 : ssrc(0),
27 fraction_loss(0),
28 cumulative_loss(0),
29 extended_max_sequence_number(0) {}
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000030 uint32_t ssrc;
31 int fraction_loss;
32 int cumulative_loss;
33 int extended_max_sequence_number;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000034};
35
stefan@webrtc.org0bae1fa2014-11-05 14:05:29 +000036struct SsrcStats {
37 SsrcStats()
stefan@webrtc.org168f23f2014-07-11 13:44:02 +000038 : key_frames(0),
39 delta_frames(0),
stefan@webrtc.org0bae1fa2014-11-05 14:05:29 +000040 total_bitrate_bps(0),
41 retransmit_bitrate_bps(0),
stefan@webrtc.org168f23f2014-07-11 13:44:02 +000042 avg_delay_ms(0),
43 max_delay_ms(0) {}
sprang@webrtc.orgccd42842014-01-07 09:54:34 +000044 uint32_t key_frames;
45 uint32_t delta_frames;
stefan@webrtc.org0bae1fa2014-11-05 14:05:29 +000046 // TODO(holmer): Move bitrate_bps out to the webrtc::Call layer.
47 int total_bitrate_bps;
48 int retransmit_bitrate_bps;
stefan@webrtc.org168f23f2014-07-11 13:44:02 +000049 int avg_delay_ms;
50 int max_delay_ms;
sprang@webrtc.orgccd42842014-01-07 09:54:34 +000051 StreamDataCounters rtp_stats;
52 RtcpStatistics rtcp_stats;
sprang@webrtc.orgccd42842014-01-07 09:54:34 +000053};
54
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000055// Settings for NACK, see RFC 4585 for details.
56struct NackConfig {
pbos@webrtc.orgeceb5322013-05-28 08:04:45 +000057 NackConfig() : rtp_history_ms(0) {}
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000058 // Send side: the time RTP packets are stored for retransmissions.
59 // Receive side: the time the receiver is prepared to wait for
60 // retransmissions.
pbos@webrtc.orgeceb5322013-05-28 08:04:45 +000061 // Set to '0' to disable.
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000062 int rtp_history_ms;
63};
64
65// Settings for forward error correction, see RFC 5109 for details. Set the
66// payload types to '-1' to disable.
67struct FecConfig {
pbos@webrtc.orgeceb5322013-05-28 08:04:45 +000068 FecConfig() : ulpfec_payload_type(-1), red_payload_type(-1) {}
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000069 std::string ToString() const;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000070 // Payload type used for ULPFEC packets.
71 int ulpfec_payload_type;
72
73 // Payload type used for RED packets.
74 int red_payload_type;
75};
76
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000077// RTP header extension to use for the video stream, see RFC 5285.
78struct RtpExtension {
pbos@webrtc.org3c107582014-07-20 15:27:35 +000079 RtpExtension(const std::string& name, int id) : name(name), id(id) {}
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000080 std::string ToString() const;
pbos@webrtc.org3c107582014-07-20 15:27:35 +000081 static bool IsSupported(const std::string& name);
82
pbos@webrtc.orgce90eff2013-11-20 11:48:56 +000083 static const char* kTOffset;
84 static const char* kAbsSendTime;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000085 std::string name;
86 int id;
87};
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000088
89struct VideoStream {
90 VideoStream()
91 : width(0),
92 height(0),
93 max_framerate(-1),
94 min_bitrate_bps(-1),
95 target_bitrate_bps(-1),
96 max_bitrate_bps(-1),
97 max_qp(-1) {}
98 std::string ToString() const;
99
100 size_t width;
101 size_t height;
102 int max_framerate;
103
104 int min_bitrate_bps;
105 int target_bitrate_bps;
106 int max_bitrate_bps;
107
108 int max_qp;
109
pbos@webrtc.orgb7ed7792014-10-31 13:08:10 +0000110 // Bitrate thresholds for enabling additional temporal layers. Since these are
111 // thresholds in between layers, we have one additional layer. One threshold
112 // gives two temporal layers, one below the threshold and one above, two give
113 // three, and so on.
114 // The VideoEncoder may redistribute bitrates over the temporal layers so a
115 // bitrate threshold of 100k and an estimate of 105k does not imply that we
116 // get 100k in one temporal layer and 5k in the other, just that the bitrate
117 // in the first temporal layer should not exceed 100k.
118 // TODO(pbos): Apart from a special case for two-layer screencast these
119 // thresholds are not propagated to the VideoEncoder. To be implemented.
120 std::vector<int> temporal_layer_thresholds_bps;
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +0000121};
122
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000123struct VideoEncoderConfig {
124 enum ContentType {
125 kRealtimeVideo,
126 kScreenshare,
127 };
128
129 VideoEncoderConfig()
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000130 : content_type(kRealtimeVideo),
131 encoder_specific_settings(NULL),
132 min_transmit_bitrate_bps(0) {}
133
134 std::string ToString() const;
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000135
136 std::vector<VideoStream> streams;
137 ContentType content_type;
138 void* encoder_specific_settings;
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000139
140 // Padding will be used up to this bitrate regardless of the bitrate produced
141 // by the encoder. Padding above what's actually produced by the encoder helps
142 // maintaining a higher bitrate estimate. Padding will however not be sent
143 // unless the estimated bandwidth indicates that the link can handle it.
144 int min_transmit_bitrate_bps;
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000145};
146
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +0000147} // namespace webrtc
148
pbos@webrtc.org3c107582014-07-20 15:27:35 +0000149#endif // WEBRTC_CONFIG_H_