blob: cd5a23ffc1e24b3c02f13e0446ff9bb25f3f0404 [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
stefan@webrtc.org0bae1fa2014-11-05 14:05:29 +000024struct SsrcStats {
25 SsrcStats()
pbos@webrtc.orgce4e9a32014-12-18 13:50:16 +000026 : sent_width(0),
pbos@webrtc.org273a4142014-12-01 15:23:21 +000027 sent_height(0),
stefan@webrtc.org0bae1fa2014-11-05 14:05:29 +000028 total_bitrate_bps(0),
29 retransmit_bitrate_bps(0),
stefan@webrtc.org168f23f2014-07-11 13:44:02 +000030 avg_delay_ms(0),
31 max_delay_ms(0) {}
pbos@webrtc.orgce4e9a32014-12-18 13:50:16 +000032 FrameCounts frame_counts;
pbos@webrtc.org273a4142014-12-01 15:23:21 +000033 int sent_width;
34 int sent_height;
stefan@webrtc.org0bae1fa2014-11-05 14:05:29 +000035 // TODO(holmer): Move bitrate_bps out to the webrtc::Call layer.
36 int total_bitrate_bps;
37 int retransmit_bitrate_bps;
stefan@webrtc.org168f23f2014-07-11 13:44:02 +000038 int avg_delay_ms;
39 int max_delay_ms;
sprang@webrtc.orgccd42842014-01-07 09:54:34 +000040 StreamDataCounters rtp_stats;
41 RtcpStatistics rtcp_stats;
sprang@webrtc.orgccd42842014-01-07 09:54:34 +000042};
43
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000044// Settings for NACK, see RFC 4585 for details.
45struct NackConfig {
pbos@webrtc.orgeceb5322013-05-28 08:04:45 +000046 NackConfig() : rtp_history_ms(0) {}
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000047 // Send side: the time RTP packets are stored for retransmissions.
48 // Receive side: the time the receiver is prepared to wait for
49 // retransmissions.
pbos@webrtc.orgeceb5322013-05-28 08:04:45 +000050 // Set to '0' to disable.
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000051 int rtp_history_ms;
52};
53
54// Settings for forward error correction, see RFC 5109 for details. Set the
55// payload types to '-1' to disable.
56struct FecConfig {
andrew@webrtc.org8f27fcc2015-01-09 20:22:46 +000057 FecConfig() : ulpfec_payload_type(-1), red_payload_type(-1) {}
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000058 std::string ToString() const;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000059 // Payload type used for ULPFEC packets.
60 int ulpfec_payload_type;
61
62 // Payload type used for RED packets.
63 int red_payload_type;
64};
65
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000066// RTP header extension to use for the video stream, see RFC 5285.
67struct RtpExtension {
pbos@webrtc.org3c107582014-07-20 15:27:35 +000068 RtpExtension(const std::string& name, int id) : name(name), id(id) {}
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000069 std::string ToString() const;
pbos@webrtc.org3c107582014-07-20 15:27:35 +000070 static bool IsSupported(const std::string& name);
71
pbos@webrtc.orgce90eff2013-11-20 11:48:56 +000072 static const char* kTOffset;
73 static const char* kAbsSendTime;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000074 std::string name;
75 int id;
76};
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000077
78struct VideoStream {
79 VideoStream()
80 : width(0),
81 height(0),
82 max_framerate(-1),
83 min_bitrate_bps(-1),
84 target_bitrate_bps(-1),
85 max_bitrate_bps(-1),
86 max_qp(-1) {}
87 std::string ToString() const;
88
89 size_t width;
90 size_t height;
91 int max_framerate;
92
93 int min_bitrate_bps;
94 int target_bitrate_bps;
95 int max_bitrate_bps;
96
97 int max_qp;
98
pbos@webrtc.orgb7ed7792014-10-31 13:08:10 +000099 // Bitrate thresholds for enabling additional temporal layers. Since these are
100 // thresholds in between layers, we have one additional layer. One threshold
101 // gives two temporal layers, one below the threshold and one above, two give
102 // three, and so on.
103 // The VideoEncoder may redistribute bitrates over the temporal layers so a
104 // bitrate threshold of 100k and an estimate of 105k does not imply that we
105 // get 100k in one temporal layer and 5k in the other, just that the bitrate
106 // in the first temporal layer should not exceed 100k.
107 // TODO(pbos): Apart from a special case for two-layer screencast these
108 // thresholds are not propagated to the VideoEncoder. To be implemented.
109 std::vector<int> temporal_layer_thresholds_bps;
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +0000110};
111
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000112struct VideoEncoderConfig {
113 enum ContentType {
114 kRealtimeVideo,
115 kScreenshare,
116 };
117
118 VideoEncoderConfig()
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000119 : content_type(kRealtimeVideo),
120 encoder_specific_settings(NULL),
121 min_transmit_bitrate_bps(0) {}
122
123 std::string ToString() const;
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000124
125 std::vector<VideoStream> streams;
126 ContentType content_type;
127 void* encoder_specific_settings;
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000128
129 // Padding will be used up to this bitrate regardless of the bitrate produced
130 // by the encoder. Padding above what's actually produced by the encoder helps
131 // maintaining a higher bitrate estimate. Padding will however not be sent
132 // unless the estimated bandwidth indicates that the link can handle it.
133 int min_transmit_bitrate_bps;
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000134};
135
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +0000136} // namespace webrtc
137
pbos@webrtc.org3c107582014-07-20 15:27:35 +0000138#endif // WEBRTC_CONFIG_H_