blob: b6155c05f8d2d2ec2b618ee29834548cb906c1dd [file] [log] [blame]
Stefan Holmer1acbd682017-09-01 13:29:281/*
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 04:47:3111#ifndef CALL_RTP_CONFIG_H_
12#define CALL_RTP_CONFIG_H_
Stefan Holmer1acbd682017-09-01 13:29:2813
Yves Gerey988cc082018-10-23 10:03:0114#include <stddef.h>
15#include <stdint.h>
Stefan Holmer1acbd682017-09-01 13:29:2816#include <string>
Stefan Holmerdbdb3a02018-07-17 14:03:4617#include <vector>
18
19#include "api/rtp_headers.h"
Steve Anton10542f22019-01-11 17:11:0020#include "api/rtp_parameters.h"
Stefan Holmer1acbd682017-09-01 13:29:2821
22namespace webrtc {
Stefan Holmerdbdb3a02018-07-17 14:03:4623// Currently only VP8/VP9 specific.
24struct RtpPayloadState {
25 int16_t picture_id = -1;
26 uint8_t tl0_pic_idx = 0;
philipel25d31ec2018-08-08 14:33:0127 int64_t shared_frame_id = 0;
Stefan Holmerdbdb3a02018-07-17 14:03:4628};
Stefan Holmer1acbd682017-09-01 13:29:2829// 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 14:03:4659
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 17:23:3869 // 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 14:03:4677 // 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 10:22:0587 // Corresponds to the SDP attribute extmap-allow-mixed.
88 bool extmap_allow_mixed = false;
89
Stefan Holmerdbdb3a02018-07-17 14:03:4690 // 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;
102
103 // See NackConfig for description.
104 NackConfig nack;
105
106 // See UlpfecConfig for description.
107 UlpfecConfig ulpfec;
108
109 struct Flexfec {
110 Flexfec();
111 Flexfec(const Flexfec&);
112 ~Flexfec();
113 // Payload type of FlexFEC. Set to -1 to disable sending FlexFEC.
114 int payload_type = -1;
115
116 // SSRC of FlexFEC stream.
117 uint32_t ssrc = 0;
118
119 // Vector containing a single element, corresponding to the SSRC of the
120 // media stream being protected by this FlexFEC stream.
121 // The vector MUST have size 1.
122 //
123 // TODO(brandtr): Update comment above when we support
124 // multistream protection.
125 std::vector<uint32_t> protected_media_ssrcs;
126 } flexfec;
127
128 // Settings for RTP retransmission payload format, see RFC 4588 for
129 // details.
130 struct Rtx {
131 Rtx();
132 Rtx(const Rtx&);
133 ~Rtx();
134 std::string ToString() const;
135 // SSRCs to use for the RTX streams.
136 std::vector<uint32_t> ssrcs;
137
138 // Payload type to use for the RTX stream.
139 int payload_type = -1;
140 } rtx;
141
142 // RTCP CNAME, see RFC 3550.
143 std::string c_name;
144};
Stefan Holmer1acbd682017-09-01 13:29:28145} // namespace webrtc
Mirko Bonadei92ea95e2017-09-15 04:47:31146#endif // CALL_RTP_CONFIG_H_