Skip to content

Commit

Permalink
feat(sdp-types): add DTLS-SRTP transport variants
Browse files Browse the repository at this point in the history
  • Loading branch information
kbalt committed Dec 19, 2024
1 parent 944a044 commit 1757144
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/sdp-types/src/media.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ pub enum TransportProtocol {
/// SRTP with [RFC5124](https://www.rfc-editor.org/rfc/rfc5124.html)
RtpSavpf,

/// DTLS-SRTP
UdpTlsRtpSavp,

/// DTLS-SRTP with [RFC5124](https://www.rfc-editor.org/rfc/rfc5124.html)
UdpTlsRtpSavpf,

/// Other unknown
Other(BytesStr),
}
Expand All @@ -69,6 +75,12 @@ impl TransportProtocol {
map(tag("RTP/AVP"), |_| TransportProtocol::RtpAvp),
map(tag("RTP/SAVP"), |_| TransportProtocol::RtpSavp),
map(tag("RTP/SAVPF"), |_| TransportProtocol::RtpSavpf),
map(tag("UDP/TLS/RTP/SAVP"), |_| {
TransportProtocol::UdpTlsRtpSavp
}),
map(tag("UDP/TLS/RTP/SAVPF"), |_| {
TransportProtocol::UdpTlsRtpSavpf
}),
map(take_while1(not_whitespace), |tp| {
TransportProtocol::Other(BytesStr::from_parse(src, tp))
}),
Expand All @@ -84,6 +96,8 @@ impl fmt::Display for TransportProtocol {
TransportProtocol::RtpAvp => f.write_str("RTP/AVP"),
TransportProtocol::RtpSavp => f.write_str("RTP/SAVP"),
TransportProtocol::RtpSavpf => f.write_str("RTP/SAVPF"),
TransportProtocol::UdpTlsRtpSavp => f.write_str("UDP/TLS/RTP/SAVP"),
TransportProtocol::UdpTlsRtpSavpf => f.write_str("UDP/TLS/RTP/SAVPF"),
TransportProtocol::Other(str) => f.write_str(str),
}
}
Expand Down

0 comments on commit 1757144

Please sign in to comment.