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