blob: e43a58805d7496ed89581804f09072a38224ff41 [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 {
andrew@webrtc.org8f27fcc2015-01-09 20:22:46 +000037 FecConfig() : ulpfec_payload_type(-1), red_payload_type(-1) {}
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000038 std::string ToString() const;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000039 // Payload type used for ULPFEC packets.
40 int ulpfec_payload_type;
41
42 // Payload type used for RED packets.
43 int red_payload_type;
44};
45
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000046// RTP header extension to use for the video stream, see RFC 5285.
47struct RtpExtension {
pbos@webrtc.org3c107582014-07-20 15:27:35 +000048 RtpExtension(const std::string& name, int id) : name(name), id(id) {}
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000049 std::string ToString() const;
pbos@webrtc.org3c107582014-07-20 15:27:35 +000050 static bool IsSupported(const std::string& name);
51
pbos@webrtc.orgce90eff2013-11-20 11:48:56 +000052 static const char* kTOffset;
53 static const char* kAbsSendTime;
guoweis@webrtc.orgfdd10572015-03-12 20:50:57 +000054 static const char* kVideoRotation;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000055 std::string name;
56 int id;
57};
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000058
59struct VideoStream {
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +000060 VideoStream();
61 ~VideoStream();
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000062 std::string ToString() const;
63
64 size_t width;
65 size_t height;
66 int max_framerate;
67
68 int min_bitrate_bps;
69 int target_bitrate_bps;
70 int max_bitrate_bps;
71
72 int max_qp;
73
pbos@webrtc.orgb7ed7792014-10-31 13:08:10 +000074 // Bitrate thresholds for enabling additional temporal layers. Since these are
75 // thresholds in between layers, we have one additional layer. One threshold
76 // gives two temporal layers, one below the threshold and one above, two give
77 // three, and so on.
78 // The VideoEncoder may redistribute bitrates over the temporal layers so a
79 // bitrate threshold of 100k and an estimate of 105k does not imply that we
80 // get 100k in one temporal layer and 5k in the other, just that the bitrate
81 // in the first temporal layer should not exceed 100k.
82 // TODO(pbos): Apart from a special case for two-layer screencast these
83 // thresholds are not propagated to the VideoEncoder. To be implemented.
84 std::vector<int> temporal_layer_thresholds_bps;
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000085};
86
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +000087struct VideoEncoderConfig {
88 enum ContentType {
89 kRealtimeVideo,
90 kScreenshare,
91 };
92
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +000093 VideoEncoderConfig();
94 ~VideoEncoderConfig();
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +000095 std::string ToString() const;
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +000096
97 std::vector<VideoStream> streams;
98 ContentType content_type;
99 void* encoder_specific_settings;
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000100
101 // Padding will be used up to this bitrate regardless of the bitrate produced
102 // by the encoder. Padding above what's actually produced by the encoder helps
103 // maintaining a higher bitrate estimate. Padding will however not be sent
104 // unless the estimated bandwidth indicates that the link can handle it.
105 int min_transmit_bitrate_bps;
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000106};
107
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +0000108} // namespace webrtc
109
pbos@webrtc.org3c107582014-07-20 15:27:35 +0000110#endif // WEBRTC_CONFIG_H_