blob: 96fe15fbb1487f7b937830789bc29a39ecdb8b88 [file] [log] [blame]
Stefan Holmer1acbd682017-09-01 15:29:28 +02001/*
2 * Copyright (c) 2017 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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef CALL_RTP_CONFIG_H_
12#define CALL_RTP_CONFIG_H_
Stefan Holmer1acbd682017-09-01 15:29:28 +020013
14#include <string>
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020015#include <vector>
16
17#include "api/rtp_headers.h"
18#include "api/rtpparameters.h"
Stefan Holmer1acbd682017-09-01 15:29:28 +020019
20namespace webrtc {
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020021// Currently only VP8/VP9 specific.
22struct RtpPayloadState {
23 int16_t picture_id = -1;
24 uint8_t tl0_pic_idx = 0;
25};
Stefan Holmer1acbd682017-09-01 15:29:28 +020026// Settings for NACK, see RFC 4585 for details.
27struct NackConfig {
28 NackConfig() : rtp_history_ms(0) {}
29 std::string ToString() const;
30 // Send side: the time RTP packets are stored for retransmissions.
31 // Receive side: the time the receiver is prepared to wait for
32 // retransmissions.
33 // Set to '0' to disable.
34 int rtp_history_ms;
35};
36
37// Settings for ULPFEC forward error correction.
38// Set the payload types to '-1' to disable.
39struct UlpfecConfig {
40 UlpfecConfig()
41 : ulpfec_payload_type(-1),
42 red_payload_type(-1),
43 red_rtx_payload_type(-1) {}
44 std::string ToString() const;
45 bool operator==(const UlpfecConfig& other) const;
46
47 // Payload type used for ULPFEC packets.
48 int ulpfec_payload_type;
49
50 // Payload type used for RED packets.
51 int red_payload_type;
52
53 // RTX payload type for RED payload.
54 int red_rtx_payload_type;
55};
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020056
57static const size_t kDefaultMaxPacketSize = 1500 - 40; // TCP over IPv4.
58struct RtpConfig {
59 RtpConfig();
60 RtpConfig(const RtpConfig&);
61 ~RtpConfig();
62 std::string ToString() const;
63
64 std::vector<uint32_t> ssrcs;
65
66 // The value to send in the MID RTP header extension if the extension is
67 // included in the list of extensions.
68 std::string mid;
69
70 // See RtcpMode for description.
71 RtcpMode rtcp_mode = RtcpMode::kCompound;
72
73 // Max RTP packet size delivered to send transport from VideoEngine.
74 size_t max_packet_size = kDefaultMaxPacketSize;
75
76 // RTP header extensions to use for this send stream.
77 std::vector<RtpExtension> extensions;
78
79 // TODO(nisse): For now, these are fixed, but we'd like to support
80 // changing codec without recreating the VideoSendStream. Then these
81 // fields must be removed, and association between payload type and codec
82 // must move above the per-stream level. Ownership could be with
83 // RtpTransportControllerSend, with a reference from PayloadRouter, where
84 // the latter would be responsible for mapping the codec type of encoded
85 // images to the right payload type.
86 std::string payload_name;
87 int payload_type = -1;
88
89 // See NackConfig for description.
90 NackConfig nack;
91
92 // See UlpfecConfig for description.
93 UlpfecConfig ulpfec;
94
95 struct Flexfec {
96 Flexfec();
97 Flexfec(const Flexfec&);
98 ~Flexfec();
99 // Payload type of FlexFEC. Set to -1 to disable sending FlexFEC.
100 int payload_type = -1;
101
102 // SSRC of FlexFEC stream.
103 uint32_t ssrc = 0;
104
105 // Vector containing a single element, corresponding to the SSRC of the
106 // media stream being protected by this FlexFEC stream.
107 // The vector MUST have size 1.
108 //
109 // TODO(brandtr): Update comment above when we support
110 // multistream protection.
111 std::vector<uint32_t> protected_media_ssrcs;
112 } flexfec;
113
114 // Settings for RTP retransmission payload format, see RFC 4588 for
115 // details.
116 struct Rtx {
117 Rtx();
118 Rtx(const Rtx&);
119 ~Rtx();
120 std::string ToString() const;
121 // SSRCs to use for the RTX streams.
122 std::vector<uint32_t> ssrcs;
123
124 // Payload type to use for the RTX stream.
125 int payload_type = -1;
126 } rtx;
127
128 // RTCP CNAME, see RFC 3550.
129 std::string c_name;
130};
131
132struct RtcpConfig {
133 RtcpConfig();
134 RtcpConfig(const RtcpConfig&);
135 ~RtcpConfig();
136 std::string ToString() const;
137
138 // Time interval between RTCP report for video
139 int64_t video_report_interval_ms = 1000;
140 // Time interval between RTCP report for audio
141 int64_t audio_report_interval_ms = 5000;
142};
Stefan Holmer1acbd682017-09-01 15:29:28 +0200143} // namespace webrtc
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200144#endif // CALL_RTP_CONFIG_H_