blob: 6f3fb1d665790fcd411a2dabd4cd1baa4aa7b67a [file] [log] [blame]
mflodman@webrtc.org06e80262013-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.org24e20892013-10-28 16:32:01 +000011// TODO(pbos): Move Config from common.h to here.
12
pbos@webrtc.orgf0a119f2014-07-20 15:27:35 +000013#ifndef WEBRTC_CONFIG_H_
14#define WEBRTC_CONFIG_H_
mflodman@webrtc.org06e80262013-04-18 12:02:52 +000015
16#include <string>
pbos@webrtc.org041d54b2013-09-16 13:01:47 +000017#include <vector>
mflodman@webrtc.org06e80262013-04-18 12:02:52 +000018
sprang@webrtc.org49812e62014-01-07 09:54:34 +000019#include "webrtc/common_types.h"
pbos@webrtc.org346dbe72013-11-20 11:48:56 +000020#include "webrtc/typedefs.h"
21
mflodman@webrtc.org06e80262013-04-18 12:02:52 +000022namespace webrtc {
mflodman@webrtc.org06e80262013-04-18 12:02:52 +000023
mflodman@webrtc.org06e80262013-04-18 12:02:52 +000024struct RtpStatistics {
pbos@webrtc.orgb2d1a402013-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.org06e80262013-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.org06e80262013-04-18 12:02:52 +000034};
35
sprang@webrtc.org49812e62014-01-07 09:54:34 +000036struct StreamStats {
stefan@webrtc.org55b0f2e2014-07-11 13:44:02 +000037 StreamStats()
38 : key_frames(0),
39 delta_frames(0),
40 bitrate_bps(0),
41 avg_delay_ms(0),
42 max_delay_ms(0) {}
sprang@webrtc.org49812e62014-01-07 09:54:34 +000043 uint32_t key_frames;
44 uint32_t delta_frames;
45 int32_t bitrate_bps;
stefan@webrtc.org55b0f2e2014-07-11 13:44:02 +000046 int avg_delay_ms;
47 int max_delay_ms;
sprang@webrtc.org49812e62014-01-07 09:54:34 +000048 StreamDataCounters rtp_stats;
49 RtcpStatistics rtcp_stats;
sprang@webrtc.org49812e62014-01-07 09:54:34 +000050};
51
mflodman@webrtc.org06e80262013-04-18 12:02:52 +000052// Settings for NACK, see RFC 4585 for details.
53struct NackConfig {
pbos@webrtc.orgb2d1a402013-05-28 08:04:45 +000054 NackConfig() : rtp_history_ms(0) {}
mflodman@webrtc.org06e80262013-04-18 12:02:52 +000055 // Send side: the time RTP packets are stored for retransmissions.
56 // Receive side: the time the receiver is prepared to wait for
57 // retransmissions.
pbos@webrtc.orgb2d1a402013-05-28 08:04:45 +000058 // Set to '0' to disable.
mflodman@webrtc.org06e80262013-04-18 12:02:52 +000059 int rtp_history_ms;
60};
61
62// Settings for forward error correction, see RFC 5109 for details. Set the
63// payload types to '-1' to disable.
64struct FecConfig {
pbos@webrtc.orgb2d1a402013-05-28 08:04:45 +000065 FecConfig() : ulpfec_payload_type(-1), red_payload_type(-1) {}
pbos@webrtc.org7e686932014-05-15 09:35:06 +000066 std::string ToString() const;
mflodman@webrtc.org06e80262013-04-18 12:02:52 +000067 // Payload type used for ULPFEC packets.
68 int ulpfec_payload_type;
69
70 // Payload type used for RED packets.
71 int red_payload_type;
72};
73
mflodman@webrtc.org06e80262013-04-18 12:02:52 +000074// RTP header extension to use for the video stream, see RFC 5285.
75struct RtpExtension {
pbos@webrtc.orgf0a119f2014-07-20 15:27:35 +000076 RtpExtension(const std::string& name, int id) : name(name), id(id) {}
pbos@webrtc.org7e686932014-05-15 09:35:06 +000077 std::string ToString() const;
pbos@webrtc.orgf0a119f2014-07-20 15:27:35 +000078 static bool IsSupported(const std::string& name);
79
pbos@webrtc.org346dbe72013-11-20 11:48:56 +000080 static const char* kTOffset;
81 static const char* kAbsSendTime;
mflodman@webrtc.org06e80262013-04-18 12:02:52 +000082 std::string name;
83 int id;
84};
pbos@webrtc.org7e686932014-05-15 09:35:06 +000085
86struct VideoStream {
87 VideoStream()
88 : width(0),
89 height(0),
90 max_framerate(-1),
91 min_bitrate_bps(-1),
92 target_bitrate_bps(-1),
93 max_bitrate_bps(-1),
94 max_qp(-1) {}
95 std::string ToString() const;
96
97 size_t width;
98 size_t height;
99 int max_framerate;
100
101 int min_bitrate_bps;
102 int target_bitrate_bps;
103 int max_bitrate_bps;
104
105 int max_qp;
106
107 // Bitrate thresholds for enabling additional temporal layers.
108 std::vector<int> temporal_layers;
109};
110
pbos@webrtc.org58b51402014-09-19 12:30:25 +0000111struct VideoEncoderConfig {
112 enum ContentType {
113 kRealtimeVideo,
114 kScreenshare,
115 };
116
117 VideoEncoderConfig()
118 : content_type(kRealtimeVideo), encoder_specific_settings(NULL) {}
119
120 std::vector<VideoStream> streams;
121 ContentType content_type;
122 void* encoder_specific_settings;
123};
124
mflodman@webrtc.org06e80262013-04-18 12:02:52 +0000125} // namespace webrtc
126
pbos@webrtc.orgf0a119f2014-07-20 15:27:35 +0000127#endif // WEBRTC_CONFIG_H_