blob: 0af48a5d571f101045e8df7d06f9d7bcf8c3cf23 [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
Yves Gerey988cc082018-10-23 12:03:01 +020014#include <stddef.h>
15#include <stdint.h>
Stefan Holmer1acbd682017-09-01 15:29:28 +020016#include <string>
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020017#include <vector>
18
19#include "api/rtp_headers.h"
Steve Anton10542f22019-01-11 09:11:00 -080020#include "api/rtp_parameters.h"
Stefan Holmer1acbd682017-09-01 15:29:28 +020021
22namespace webrtc {
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020023// Currently only VP8/VP9 specific.
24struct RtpPayloadState {
25 int16_t picture_id = -1;
26 uint8_t tl0_pic_idx = 0;
philipel25d31ec2018-08-08 16:33:01 +020027 int64_t shared_frame_id = 0;
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020028};
Elad Alonfadb1812019-05-24 13:40:02 +020029
30// Settings for LNTF (LossNotification). Still highly experimental.
31struct LntfConfig {
32 std::string ToString() const;
33
Elad Alona0e99432019-05-24 13:50:56 +020034 bool enabled{false};
Elad Alonfadb1812019-05-24 13:40:02 +020035};
36
Stefan Holmer1acbd682017-09-01 15:29:28 +020037// Settings for NACK, see RFC 4585 for details.
38struct NackConfig {
39 NackConfig() : rtp_history_ms(0) {}
40 std::string ToString() const;
41 // Send side: the time RTP packets are stored for retransmissions.
42 // Receive side: the time the receiver is prepared to wait for
43 // retransmissions.
44 // Set to '0' to disable.
45 int rtp_history_ms;
46};
47
48// Settings for ULPFEC forward error correction.
49// Set the payload types to '-1' to disable.
50struct UlpfecConfig {
51 UlpfecConfig()
52 : ulpfec_payload_type(-1),
53 red_payload_type(-1),
54 red_rtx_payload_type(-1) {}
55 std::string ToString() const;
56 bool operator==(const UlpfecConfig& other) const;
57
58 // Payload type used for ULPFEC packets.
59 int ulpfec_payload_type;
60
61 // Payload type used for RED packets.
62 int red_payload_type;
63
64 // RTX payload type for RED payload.
65 int red_rtx_payload_type;
66};
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020067
68static const size_t kDefaultMaxPacketSize = 1500 - 40; // TCP over IPv4.
69struct RtpConfig {
70 RtpConfig();
71 RtpConfig(const RtpConfig&);
72 ~RtpConfig();
73 std::string ToString() const;
74
75 std::vector<uint32_t> ssrcs;
76
Amit Hilbuch77938e62018-12-21 09:23:38 -080077 // The Rtp Stream Ids (aka RIDs) to send in the RID RTP header extension
78 // if the extension is included in the list of extensions.
79 // If rids are specified, they should correspond to the |ssrcs| vector.
80 // This means that:
81 // 1. rids.size() == 0 || rids.size() == ssrcs.size().
82 // 2. If rids is not empty, then |rids[i]| should use |ssrcs[i]|.
83 std::vector<std::string> rids;
84
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020085 // The value to send in the MID RTP header extension if the extension is
86 // included in the list of extensions.
87 std::string mid;
88
89 // See RtcpMode for description.
90 RtcpMode rtcp_mode = RtcpMode::kCompound;
91
92 // Max RTP packet size delivered to send transport from VideoEngine.
93 size_t max_packet_size = kDefaultMaxPacketSize;
94
Johannes Kron9190b822018-10-29 11:22:05 +010095 // Corresponds to the SDP attribute extmap-allow-mixed.
96 bool extmap_allow_mixed = false;
97
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020098 // RTP header extensions to use for this send stream.
99 std::vector<RtpExtension> extensions;
100
101 // TODO(nisse): For now, these are fixed, but we'd like to support
102 // changing codec without recreating the VideoSendStream. Then these
103 // fields must be removed, and association between payload type and codec
104 // must move above the per-stream level. Ownership could be with
105 // RtpTransportControllerSend, with a reference from PayloadRouter, where
106 // the latter would be responsible for mapping the codec type of encoded
107 // images to the right payload type.
108 std::string payload_name;
109 int payload_type = -1;
Mirta Dvornicicfe68daa2019-05-23 13:21:12 +0200110 // Payload should be packetized using raw packetizer (payload header will
111 // not be added, additional meta data is expected to be present in generic
112 // frame descriptor RTP header extension).
113 bool raw_payload = false;
Stefan Holmerdbdb3a02018-07-17 16:03:46 +0200114
Elad Alonfadb1812019-05-24 13:40:02 +0200115 // See LntfConfig for description.
116 LntfConfig lntf;
117
Stefan Holmerdbdb3a02018-07-17 16:03:46 +0200118 // See NackConfig for description.
119 NackConfig nack;
120
121 // See UlpfecConfig for description.
122 UlpfecConfig ulpfec;
123
124 struct Flexfec {
125 Flexfec();
126 Flexfec(const Flexfec&);
127 ~Flexfec();
128 // Payload type of FlexFEC. Set to -1 to disable sending FlexFEC.
129 int payload_type = -1;
130
131 // SSRC of FlexFEC stream.
132 uint32_t ssrc = 0;
133
134 // Vector containing a single element, corresponding to the SSRC of the
135 // media stream being protected by this FlexFEC stream.
136 // The vector MUST have size 1.
137 //
138 // TODO(brandtr): Update comment above when we support
139 // multistream protection.
140 std::vector<uint32_t> protected_media_ssrcs;
141 } flexfec;
142
143 // Settings for RTP retransmission payload format, see RFC 4588 for
144 // details.
145 struct Rtx {
146 Rtx();
147 Rtx(const Rtx&);
148 ~Rtx();
149 std::string ToString() const;
150 // SSRCs to use for the RTX streams.
151 std::vector<uint32_t> ssrcs;
152
153 // Payload type to use for the RTX stream.
154 int payload_type = -1;
155 } rtx;
156
157 // RTCP CNAME, see RFC 3550.
158 std::string c_name;
159};
Stefan Holmer1acbd682017-09-01 15:29:28 +0200160} // namespace webrtc
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200161#endif // CALL_RTP_CONFIG_H_