blob: 0acddc3ee25f405a661639967f3a19ec27272dba [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
79 // RTP header extensions to use for this send stream.
80 std::vector<RtpExtension> extensions;
81
82 // TODO(nisse): For now, these are fixed, but we'd like to support
83 // changing codec without recreating the VideoSendStream. Then these
84 // fields must be removed, and association between payload type and codec
85 // must move above the per-stream level. Ownership could be with
86 // RtpTransportControllerSend, with a reference from PayloadRouter, where
87 // the latter would be responsible for mapping the codec type of encoded
88 // images to the right payload type.
89 std::string payload_name;
90 int payload_type = -1;
91
92 // See NackConfig for description.
93 NackConfig nack;
94
95 // See UlpfecConfig for description.
96 UlpfecConfig ulpfec;
97
98 struct Flexfec {
99 Flexfec();
100 Flexfec(const Flexfec&);
101 ~Flexfec();
102 // Payload type of FlexFEC. Set to -1 to disable sending FlexFEC.
103 int payload_type = -1;
104
105 // SSRC of FlexFEC stream.
106 uint32_t ssrc = 0;
107
108 // Vector containing a single element, corresponding to the SSRC of the
109 // media stream being protected by this FlexFEC stream.
110 // The vector MUST have size 1.
111 //
112 // TODO(brandtr): Update comment above when we support
113 // multistream protection.
114 std::vector<uint32_t> protected_media_ssrcs;
115 } flexfec;
116
117 // Settings for RTP retransmission payload format, see RFC 4588 for
118 // details.
119 struct Rtx {
120 Rtx();
121 Rtx(const Rtx&);
122 ~Rtx();
123 std::string ToString() const;
124 // SSRCs to use for the RTX streams.
125 std::vector<uint32_t> ssrcs;
126
127 // Payload type to use for the RTX stream.
128 int payload_type = -1;
129 } rtx;
130
131 // RTCP CNAME, see RFC 3550.
132 std::string c_name;
133};
134
135struct RtcpConfig {
136 RtcpConfig();
137 RtcpConfig(const RtcpConfig&);
138 ~RtcpConfig();
139 std::string ToString() const;
140
141 // Time interval between RTCP report for video
142 int64_t video_report_interval_ms = 1000;
143 // Time interval between RTCP report for audio
144 int64_t audio_report_interval_ms = 5000;
145};
Stefan Holmer1acbd682017-09-01 15:29:28 +0200146} // namespace webrtc
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200147#endif // CALL_RTP_CONFIG_H_