blob: adffc89d12e4afc2b9b7feced64f638cb486d275 [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};
Stefan Holmer1acbd682017-09-01 15:29:28 +020029// Settings for NACK, see RFC 4585 for details.
30struct NackConfig {
31 NackConfig() : rtp_history_ms(0) {}
32 std::string ToString() const;
33 // Send side: the time RTP packets are stored for retransmissions.
34 // Receive side: the time the receiver is prepared to wait for
35 // retransmissions.
36 // Set to '0' to disable.
37 int rtp_history_ms;
38};
39
40// Settings for ULPFEC forward error correction.
41// Set the payload types to '-1' to disable.
42struct UlpfecConfig {
43 UlpfecConfig()
44 : ulpfec_payload_type(-1),
45 red_payload_type(-1),
46 red_rtx_payload_type(-1) {}
47 std::string ToString() const;
48 bool operator==(const UlpfecConfig& other) const;
49
50 // Payload type used for ULPFEC packets.
51 int ulpfec_payload_type;
52
53 // Payload type used for RED packets.
54 int red_payload_type;
55
56 // RTX payload type for RED payload.
57 int red_rtx_payload_type;
58};
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020059
60static const size_t kDefaultMaxPacketSize = 1500 - 40; // TCP over IPv4.
61struct RtpConfig {
62 RtpConfig();
63 RtpConfig(const RtpConfig&);
64 ~RtpConfig();
65 std::string ToString() const;
66
67 std::vector<uint32_t> ssrcs;
68
Amit Hilbuch77938e62018-12-21 09:23:38 -080069 // The Rtp Stream Ids (aka RIDs) to send in the RID RTP header extension
70 // if the extension is included in the list of extensions.
71 // If rids are specified, they should correspond to the |ssrcs| vector.
72 // This means that:
73 // 1. rids.size() == 0 || rids.size() == ssrcs.size().
74 // 2. If rids is not empty, then |rids[i]| should use |ssrcs[i]|.
75 std::vector<std::string> rids;
76
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020077 // The value to send in the MID RTP header extension if the extension is
78 // included in the list of extensions.
79 std::string mid;
80
81 // See RtcpMode for description.
82 RtcpMode rtcp_mode = RtcpMode::kCompound;
83
84 // Max RTP packet size delivered to send transport from VideoEngine.
85 size_t max_packet_size = kDefaultMaxPacketSize;
86
Johannes Kron9190b822018-10-29 11:22:05 +010087 // Corresponds to the SDP attribute extmap-allow-mixed.
88 bool extmap_allow_mixed = false;
89
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020090 // RTP header extensions to use for this send stream.
91 std::vector<RtpExtension> extensions;
92
93 // TODO(nisse): For now, these are fixed, but we'd like to support
94 // changing codec without recreating the VideoSendStream. Then these
95 // fields must be removed, and association between payload type and codec
96 // must move above the per-stream level. Ownership could be with
97 // RtpTransportControllerSend, with a reference from PayloadRouter, where
98 // the latter would be responsible for mapping the codec type of encoded
99 // images to the right payload type.
100 std::string payload_name;
101 int payload_type = -1;
Mirta Dvornicicfe68daa2019-05-23 13:21:12 +0200102 // Payload should be packetized using raw packetizer (payload header will
103 // not be added, additional meta data is expected to be present in generic
104 // frame descriptor RTP header extension).
105 bool raw_payload = false;
Stefan Holmerdbdb3a02018-07-17 16:03:46 +0200106
107 // See NackConfig for description.
108 NackConfig nack;
109
110 // See UlpfecConfig for description.
111 UlpfecConfig ulpfec;
112
113 struct Flexfec {
114 Flexfec();
115 Flexfec(const Flexfec&);
116 ~Flexfec();
117 // Payload type of FlexFEC. Set to -1 to disable sending FlexFEC.
118 int payload_type = -1;
119
120 // SSRC of FlexFEC stream.
121 uint32_t ssrc = 0;
122
123 // Vector containing a single element, corresponding to the SSRC of the
124 // media stream being protected by this FlexFEC stream.
125 // The vector MUST have size 1.
126 //
127 // TODO(brandtr): Update comment above when we support
128 // multistream protection.
129 std::vector<uint32_t> protected_media_ssrcs;
130 } flexfec;
131
132 // Settings for RTP retransmission payload format, see RFC 4588 for
133 // details.
134 struct Rtx {
135 Rtx();
136 Rtx(const Rtx&);
137 ~Rtx();
138 std::string ToString() const;
139 // SSRCs to use for the RTX streams.
140 std::vector<uint32_t> ssrcs;
141
142 // Payload type to use for the RTX stream.
143 int payload_type = -1;
144 } rtx;
145
146 // RTCP CNAME, see RFC 3550.
147 std::string c_name;
148};
Stefan Holmer1acbd682017-09-01 15:29:28 +0200149} // namespace webrtc
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200150#endif // CALL_RTP_CONFIG_H_