1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
use crate;
/// RTP coding parameters providing information for encoding and decoding.
///
/// Contains the RTP-level parameters that identify and configure a specific
/// encoding or decoding of a media stream. This includes the SSRC, optional
/// RID for simulcast identification, and parameters for retransmission (RTX)
/// and forward error correction (FEC).
///
/// # Fields
///
/// * `rid` - RTP stream identifier, used in simulcast to identify quality layers (e.g., "q", "h", "f")
/// * `ssrc` - Synchronization source identifier, uniquely identifies this RTP stream
/// * `rtx` - Optional retransmission parameters for packet loss recovery
/// * `fec` - Optional forward error correction parameters
/// * `rid_restrictions` - The restrictions of the rid's `a=rid` line (RFC 8851 section 5)
///
/// # Examples
///
/// ```
/// use rtci::rtp_transceiver::rtp_sender::RTCRtpCodingParameters;
///
/// // Basic parameters without retransmission or FEC
/// let params = RTCRtpCodingParameters {
/// rid: "".to_string(),
/// ssrc: Some(12345),
/// rtx: None,
/// fec: None,
/// ..Default::default()
/// };
/// ```
///
/// ```
/// use rtci::rtp_transceiver::rtp_sender::{RTCRtpCodingParameters, RTCRtpRtxParameters};
///
/// // Simulcast layer with retransmission
/// let params = RTCRtpCodingParameters {
/// rid: "h".to_string(), // half resolution layer
/// ssrc: Some(12345),
/// rtx: Some(RTCRtpRtxParameters {
/// ssrc: 12346, // RTX uses different SSRC
/// }),
/// fec: None,
/// ..Default::default()
/// };
/// ```
///
/// # Specification
///
/// * [ORTC RTCRtpCodingParameters](http://draft.ortc.org/#dom-rtcrtpcodingparameters)
/// * [RFC 4588 - RTP Retransmission Payload Format](https://datatracker.ietf.org/doc/html/rfc4588)
/// * [RFC 8852 - RTP Stream Identifier](https://datatracker.ietf.org/doc/html/rfc8852)
/// The restrictions an `a=rid` line places on an RTP stream (RFC 8851 section 5). `None`,
/// or an empty list, is "not restricted".
///
/// The engine carries them between the description and the application: it neither encodes
/// nor measures media, so the application's encoder is what keeps a stream within them.
///
/// # Examples
///
/// ```
/// use rtci::rtp_transceiver::rtp_sender::{RTCRtpCodingParameters, RTCRtpRidRestrictions};
///
/// // `a=rid:q send max-width=320;max-height=180;max-fps=15`
/// let quarter = RTCRtpCodingParameters {
/// rid: "q".to_string(),
/// ssrc: Some(3),
/// rid_restrictions: RTCRtpRidRestrictions {
/// max_width: Some(320),
/// max_height: Some(180),
/// max_fps: Some(15),
/// ..Default::default()
/// },
/// ..Default::default()
/// };
/// assert!(quarter.rid_restrictions.payload_types.is_empty());
/// ```
/// RTX parameters for retransmission streams.
///
/// Configures a separate RTP stream used for retransmitting lost packets.
/// The RTX stream uses its own SSRC to avoid interfering with the original
/// media stream.
///
/// # Examples
///
/// ```
/// use rtci::rtp_transceiver::rtp_sender::RTCRtpRtxParameters;
///
/// let rtx = RTCRtpRtxParameters {
/// ssrc: 67890, // Different from the main stream's SSRC
/// };
/// ```
///
/// # Specification
///
/// * [ORTC RTCRtpRtxParameters](https://draft.ortc.org/#dom-rtcrtprtxparameters)
/// * [RFC 4588 - RTP Retransmission Payload Format](https://datatracker.ietf.org/doc/html/rfc4588)
/// FEC parameters for forward error correction streams.
///
/// Configures a separate RTP stream used for forward error correction,
/// allowing receivers to recover from packet loss without retransmission.
/// The FEC stream uses its own SSRC.
///
/// # Examples
///
/// ```
/// use rtci::rtp_transceiver::rtp_sender::RTCRtpFecParameters;
///
/// let fec = RTCRtpFecParameters {
/// ssrc: 99999, // Different from the main stream's SSRC
/// };
/// ```
///
/// # Specification
///
/// * [ORTC RTCRtpFecParameters](https://draft.ortc.org/#dom-rtcrtpfecparameters)
/// * [RFC 5109 - RTP Payload Format for Generic FEC](https://datatracker.ietf.org/doc/html/rfc5109)