blob: 97ae951765c2bd23e452a1fd140e115a35869bdd [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"
20#include "api/rtpparameters.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
69 // The value to send in the MID RTP header extension if the extension is
70 // included in the list of extensions.
71 std::string mid;
72
73 // See RtcpMode for description.
74 RtcpMode rtcp_mode = RtcpMode::kCompound;
75
76 // Max RTP packet size delivered to send transport from VideoEngine.
77 size_t max_packet_size = kDefaultMaxPacketSize;
78
Johannes Kron9190b822018-10-29 11:22:05 +010079 // Corresponds to the SDP attribute extmap-allow-mixed.
80 bool extmap_allow_mixed = false;
81
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020082 // RTP header extensions to use for this send stream.
83 std::vector<RtpExtension> extensions;
84
85 // TODO(nisse): For now, these are fixed, but we'd like to support
86 // changing codec without recreating the VideoSendStream. Then these
87 // fields must be removed, and association between payload type and codec
88 // must move above the per-stream level. Ownership could be with
89 // RtpTransportControllerSend, with a reference from PayloadRouter, where
90 // the latter would be responsible for mapping the codec type of encoded
91 // images to the right payload type.
92 std::string payload_name;
93 int payload_type = -1;
94
95 // See NackConfig for description.
96 NackConfig nack;
97
98 // See UlpfecConfig for description.
99 UlpfecConfig ulpfec;
100
101 struct Flexfec {
102 Flexfec();
103 Flexfec(const Flexfec&);
104 ~Flexfec();
105 // Payload type of FlexFEC. Set to -1 to disable sending FlexFEC.
106 int payload_type = -1;
107
108 // SSRC of FlexFEC stream.
109 uint32_t ssrc = 0;
110
111 // Vector containing a single element, corresponding to the SSRC of the
112 // media stream being protected by this FlexFEC stream.
113 // The vector MUST have size 1.
114 //
115 // TODO(brandtr): Update comment above when we support
116 // multistream protection.
117 std::vector<uint32_t> protected_media_ssrcs;
118 } flexfec;
119
120 // Settings for RTP retransmission payload format, see RFC 4588 for
121 // details.
122 struct Rtx {
123 Rtx();
124 Rtx(const Rtx&);
125 ~Rtx();
126 std::string ToString() const;
127 // SSRCs to use for the RTX streams.
128 std::vector<uint32_t> ssrcs;
129
130 // Payload type to use for the RTX stream.
131 int payload_type = -1;
132 } rtx;
133
134 // RTCP CNAME, see RFC 3550.
135 std::string c_name;
136};
Stefan Holmer1acbd682017-09-01 15:29:28 +0200137} // namespace webrtc
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200138#endif // CALL_RTP_CONFIG_H_