Bug 1520289: added TCP/DTLS/RTP/SAVPF to SDP parsing. r=bwc
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Wed, 16 Jan 2019 14:38:07 +0000
changeset 511229 34476dc321b5071bded4819e76393ca140e3472b
parent 511228 d0529e2d98a3fb0259c0276e59bb70d21d782a42
child 511230 5b6bfa47b5c4d9ac5cd655c2bb997e02776c3f60
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwc
bugs1520289
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1520289: added TCP/DTLS/RTP/SAVPF to SDP parsing. r=bwc Differential Revision: https://phabricator.services.mozilla.com/D16660
media/webrtc/signaling/src/sdp/RsdparsaSdpInc.h
media/webrtc/signaling/src/sdp/RsdparsaSdpMediaSection.cpp
media/webrtc/signaling/src/sdp/SdpHelper.cpp
media/webrtc/signaling/src/sdp/SdpMediaSection.h
media/webrtc/signaling/src/sdp/SipccSdpMediaSection.cpp
media/webrtc/signaling/src/sdp/rsdparsa/src/media_type.rs
media/webrtc/signaling/src/sdp/rsdparsa_capi/src/lib.rs
media/webrtc/signaling/src/sdp/rsdparsa_capi/src/media_section.rs
media/webrtc/signaling/src/sdp/sipcc/sdp.h
media/webrtc/signaling/src/sdp/sipcc/sdp_main.c
--- a/media/webrtc/signaling/src/sdp/RsdparsaSdpInc.h
+++ b/media/webrtc/signaling/src/sdp/RsdparsaSdpInc.h
@@ -49,16 +49,17 @@ struct RustSdpOrigin {
 };
 
 enum class RustSdpMediaValue { kRustAudio, kRustVideo, kRustApplication };
 
 enum class RustSdpProtocolValue {
   kRustRtpSavpf,
   kRustUdpTlsRtpSavpf,
   kRustTcpTlsRtpSavpf,
+  kRustTcpDtlsRtpSavpf,
   kRustDtlsSctp,
   kRustUdpDtlsSctp,
   kRustTcpDtlsSctp,
 };
 
 enum class RustSdpFormatType { kRustIntegers, kRustStrings };
 
 enum class RustSdpAttributeFingerprintHashAlgorithm : uint16_t {
--- a/media/webrtc/signaling/src/sdp/RsdparsaSdpMediaSection.cpp
+++ b/media/webrtc/signaling/src/sdp/RsdparsaSdpMediaSection.cpp
@@ -60,16 +60,18 @@ unsigned int RsdparsaSdpMediaSection::Ge
 SdpMediaSection::Protocol RsdparsaSdpMediaSection::GetProtocol() const {
   switch (sdp_get_media_protocol(mSection)) {
     case RustSdpProtocolValue::kRustRtpSavpf:
       return kRtpSavpf;
     case RustSdpProtocolValue::kRustUdpTlsRtpSavpf:
       return kUdpTlsRtpSavpf;
     case RustSdpProtocolValue::kRustTcpTlsRtpSavpf:
       return kTcpTlsRtpSavpf;
+    case RustSdpProtocolValue::kRustTcpDtlsRtpSavpf:
+      return kTcpDtlsRtpSavpf;
     case RustSdpProtocolValue::kRustDtlsSctp:
       return kDtlsSctp;
     case RustSdpProtocolValue::kRustUdpDtlsSctp:
       return kUdpDtlsSctp;
     case RustSdpProtocolValue::kRustTcpDtlsSctp:
       return kTcpDtlsSctp;
   }
 
--- a/media/webrtc/signaling/src/sdp/SdpHelper.cpp
+++ b/media/webrtc/signaling/src/sdp/SdpHelper.cpp
@@ -527,16 +527,17 @@ nsresult SdpHelper::CopyStickyParams(con
 bool SdpHelper::HasRtcp(SdpMediaSection::Protocol proto) const {
   switch (proto) {
     case SdpMediaSection::kRtpAvpf:
     case SdpMediaSection::kDccpRtpAvpf:
     case SdpMediaSection::kDccpRtpSavpf:
     case SdpMediaSection::kRtpSavpf:
     case SdpMediaSection::kUdpTlsRtpSavpf:
     case SdpMediaSection::kTcpTlsRtpSavpf:
+    case SdpMediaSection::kTcpDtlsRtpSavpf:
     case SdpMediaSection::kDccpTlsRtpSavpf:
       return true;
     case SdpMediaSection::kRtpAvp:
     case SdpMediaSection::kUdp:
     case SdpMediaSection::kVat:
     case SdpMediaSection::kRtp:
     case SdpMediaSection::kUdptl:
     case SdpMediaSection::kTcp:
--- a/media/webrtc/signaling/src/sdp/SdpMediaSection.h
+++ b/media/webrtc/signaling/src/sdp/SdpMediaSection.h
@@ -47,17 +47,18 @@ class SdpMediaSection {
     kDccpRtpSavp,        // DCCP/RTP/SAVP [RFC5762]
     kDccpRtpAvpf,        // DCCP/RTP/AVPF [RFC5762]
     kDccpRtpSavpf,       // DCCP/RTP/SAVPF [RFC5762]
     kRtpSavpf,           // RTP/SAVPF [RFC5124]
     kUdpTlsRtpSavp,      // UDP/TLS/RTP/SAVP [RFC5764]
     kTcpTlsRtpSavp,      // TCP/TLS/RTP/SAVP [JSEP-TBD]
     kDccpTlsRtpSavp,     // DCCP/TLS/RTP/SAVP [RFC5764]
     kUdpTlsRtpSavpf,     // UDP/TLS/RTP/SAVPF [RFC5764]
-    kTcpTlsRtpSavpf,     // TCP/TLS/RTP/SAVPF [JSEP-TBD]
+    kTcpTlsRtpSavpf,     // TCP/TLS/RTP/SAVPF DON'T USE - NO RFC
+    kTcpDtlsRtpSavpf,    // TCP/DTLS/RTP/SAVPF [RFC7850]
     kDccpTlsRtpSavpf,    // DCCP/TLS/RTP/SAVPF [RFC5764]
     kUdpMbmsFecRtpAvp,   // UDP/MBMS-FEC/RTP/AVP [RFC6064]
     kUdpMbmsFecRtpSavp,  // UDP/MBMS-FEC/RTP/SAVP [RFC6064]
     kUdpMbmsRepair,      // UDP/MBMS-REPAIR [RFC6064]
     kFecUdp,             // FEC/UDP [RFC6364]
     kUdpFec,             // UDP/FEC [RFC6364]
     kTcpMrcpv2,          // TCP/MRCPv2 [RFC6787]
     kTcpTlsMrcpv2,       // TCP/TLS/MRCPv2 [RFC6787]
@@ -228,16 +229,18 @@ inline std::ostream& operator<<(std::ost
     case SdpMediaSection::kTcpTlsRtpSavp:
       return os << "TCP/TLS/RTP/SAVP";
     case SdpMediaSection::kDccpTlsRtpSavp:
       return os << "DCCP/TLS/RTP/SAVP";
     case SdpMediaSection::kUdpTlsRtpSavpf:
       return os << "UDP/TLS/RTP/SAVPF";
     case SdpMediaSection::kTcpTlsRtpSavpf:
       return os << "TCP/TLS/RTP/SAVPF";
+    case SdpMediaSection::kTcpDtlsRtpSavpf:
+      return os << "TCP/DTLS/RTP/SAVPF";
     case SdpMediaSection::kDccpTlsRtpSavpf:
       return os << "DCCP/TLS/RTP/SAVPF";
     case SdpMediaSection::kUdpMbmsFecRtpAvp:
       return os << "UDP/MBMS-FEC/RTP/AVP";
     case SdpMediaSection::kUdpMbmsFecRtpSavp:
       return os << "UDP/MBMS-FEC/RTP/SAVP";
     case SdpMediaSection::kUdpMbmsRepair:
       return os << "UDP/MBMS-REPAIR";
--- a/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.cpp
+++ b/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.cpp
@@ -136,16 +136,19 @@ bool SipccSdpMediaSection::LoadProtocol(
       mProtocol = kUdpTlsRtpSavpf;
       break;
     case SDP_TRANSPORT_TCPTLSRTPSAVP:
       mProtocol = kTcpTlsRtpSavp;
       break;
     case SDP_TRANSPORT_TCPTLSRTPSAVPF:
       mProtocol = kTcpTlsRtpSavpf;
       break;
+    case SDP_TRANSPORT_TCPDTLSRTPSAVPF:
+      mProtocol = kTcpDtlsRtpSavpf;
+      break;
     case SDP_TRANSPORT_DTLSSCTP:
       mProtocol = kDtlsSctp;
       break;
     case SDP_TRANSPORT_UDPDTLSSCTP:
       mProtocol = kUdpDtlsSctp;
       break;
     case SDP_TRANSPORT_TCPDTLSSCTP:
       mProtocol = kTcpDtlsSctp;
--- a/media/webrtc/signaling/src/sdp/rsdparsa/src/media_type.rs
+++ b/media/webrtc/signaling/src/sdp/rsdparsa/src/media_type.rs
@@ -33,27 +33,29 @@ impl fmt::Display for SdpMediaValue {
 }
 
 #[derive(Clone,Debug,PartialEq)]
 #[cfg_attr(feature="serialize", derive(Serialize))]
 pub enum SdpProtocolValue {
     RtpSavpf,
     UdpTlsRtpSavpf,
     TcpTlsRtpSavpf,
+    TcpDtlsRtpSavpf,
     DtlsSctp,
     UdpDtlsSctp,
     TcpDtlsSctp,
 }
 
 impl fmt::Display for SdpProtocolValue {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         let printable = match *self {
             SdpProtocolValue::RtpSavpf => "Rtp/Savpf",
             SdpProtocolValue::UdpTlsRtpSavpf => "Udp/Tls/Rtp/Savpf",
             SdpProtocolValue::TcpTlsRtpSavpf => "Tcp/Tls/Rtp/Savpf",
+            SdpProtocolValue::TcpDtlsRtpSavpf => "Tcp/Dtls/Rtp/Savpf",
             SdpProtocolValue::DtlsSctp => "Dtls/Sctp",
             SdpProtocolValue::UdpDtlsSctp => "Udp/Dtls/Sctp",
             SdpProtocolValue::TcpDtlsSctp => "Tcp/Dtls/Sctp",
         };
         write!(f, "{}", printable)
     }
 }
 
@@ -265,16 +267,17 @@ fn test_parse_media_token() {
 }
 
 
 fn parse_protocol_token(value: &str) -> Result<SdpProtocolValue, SdpParserInternalError> {
     Ok(match value.to_uppercase().as_ref() {
            "RTP/SAVPF" => SdpProtocolValue::RtpSavpf,
            "UDP/TLS/RTP/SAVPF" => SdpProtocolValue::UdpTlsRtpSavpf,
            "TCP/TLS/RTP/SAVPF" => SdpProtocolValue::TcpTlsRtpSavpf,
+           "TCP/DTLS/RTP/SAVPF" => SdpProtocolValue::TcpDtlsRtpSavpf,
            "DTLS/SCTP" => SdpProtocolValue::DtlsSctp,
            "UDP/DTLS/SCTP" => SdpProtocolValue::UdpDtlsSctp,
            "TCP/DTLS/SCTP" => SdpProtocolValue::TcpDtlsSctp,
            _ => {
                return Err(SdpParserInternalError::Unsupported(format!("unsupported protocol value: {}",
                                                                       value)))
            }
        })
@@ -286,16 +289,19 @@ fn test_parse_protocol_token() {
     assert!(rtps.is_ok());
     assert_eq!(rtps.unwrap(), SdpProtocolValue::RtpSavpf);
     let udps = parse_protocol_token("udp/tls/rtp/savpf");
     assert!(udps.is_ok());
     assert_eq!(udps.unwrap(), SdpProtocolValue::UdpTlsRtpSavpf);
     let tcps = parse_protocol_token("TCP/tls/rtp/savpf");
     assert!(tcps.is_ok());
     assert_eq!(tcps.unwrap(), SdpProtocolValue::TcpTlsRtpSavpf);
+    let tcps = parse_protocol_token("TCP/DtlS/rTp/sAVpf");
+    assert!(tcps.is_ok());
+    assert_eq!(tcps.unwrap(), SdpProtocolValue::TcpDtlsRtpSavpf);
     let dtls = parse_protocol_token("dtLs/ScTP");
     assert!(dtls.is_ok());
     assert_eq!(dtls.unwrap(), SdpProtocolValue::DtlsSctp);
     let usctp = parse_protocol_token("udp/DTLS/sctp");
     assert!(usctp.is_ok());
     assert_eq!(usctp.unwrap(), SdpProtocolValue::UdpDtlsSctp);
     let tsctp = parse_protocol_token("tcp/dtls/SCTP");
     assert!(tsctp.is_ok());
--- a/media/webrtc/signaling/src/sdp/rsdparsa_capi/src/lib.rs
+++ b/media/webrtc/signaling/src/sdp/rsdparsa_capi/src/lib.rs
@@ -150,19 +150,20 @@ pub unsafe extern "C" fn sdp_add_media_s
         _ => {
          return NS_ERROR_INVALID_ARG;
      }
     };
     let protocol = match protocol {
         20 => SdpProtocolValue::RtpSavpf,        // Protocol::kRtpSavpf
         24 => SdpProtocolValue::UdpTlsRtpSavpf,  // Protocol::kUdpTlsRtpSavpf
         25 => SdpProtocolValue::TcpTlsRtpSavpf,  // Protocol::kTcpTlsRtpSavpf
-        37 => SdpProtocolValue::DtlsSctp,        // Protocol::kDtlsSctp
-        38 => SdpProtocolValue::UdpDtlsSctp,     // Protocol::kUdpDtlsSctp
-        39 => SdpProtocolValue::TcpDtlsSctp,     // Protocol::kTcpDtlsSctp
+        26 => SdpProtocolValue::TcpDtlsRtpSavpf,  // Protocol::kTcpTlsRtpSavpf
+        38 => SdpProtocolValue::DtlsSctp,        // Protocol::kDtlsSctp
+        39 => SdpProtocolValue::UdpDtlsSctp,     // Protocol::kUdpDtlsSctp
+        40 => SdpProtocolValue::TcpDtlsSctp,     // Protocol::kTcpDtlsSctp
         _ => {
           return NS_ERROR_INVALID_ARG;
       }
     };
     let direction = match direction {
         1 => SdpAttribute::Sendonly,
         2 => SdpAttribute::Recvonly,
         3 => SdpAttribute::Sendrecv,
--- a/media/webrtc/signaling/src/sdp/rsdparsa_capi/src/media_section.rs
+++ b/media/webrtc/signaling/src/sdp/rsdparsa_capi/src/media_section.rs
@@ -45,27 +45,29 @@ pub unsafe extern "C" fn sdp_rust_get_me
 }
 
 #[repr(C)]
 #[derive(Clone, Copy)]
 pub enum RustSdpProtocolValue {
     RtpSavpf,
     UdpTlsRtpSavpf,
     TcpTlsRtpSavpf,
+    TcpDtlsRtpSavpf,
     DtlsSctp,
     UdpDtlsSctp,
     TcpDtlsSctp,
 }
 
 impl<'a> From<&'a SdpProtocolValue> for RustSdpProtocolValue {
     fn from(val: &SdpProtocolValue) -> Self {
         match *val {
             SdpProtocolValue::RtpSavpf => RustSdpProtocolValue::RtpSavpf,
             SdpProtocolValue::UdpTlsRtpSavpf => RustSdpProtocolValue::UdpTlsRtpSavpf,
             SdpProtocolValue::TcpTlsRtpSavpf => RustSdpProtocolValue::TcpTlsRtpSavpf,
+            SdpProtocolValue::TcpDtlsRtpSavpf => RustSdpProtocolValue::TcpDtlsRtpSavpf,
             SdpProtocolValue::DtlsSctp => RustSdpProtocolValue::DtlsSctp,
             SdpProtocolValue::UdpDtlsSctp => RustSdpProtocolValue::UdpDtlsSctp,
             SdpProtocolValue::TcpDtlsSctp => RustSdpProtocolValue::TcpDtlsSctp,
         }
     }
 }
 
 #[no_mangle]
--- a/media/webrtc/signaling/src/sdp/sipcc/sdp.h
+++ b/media/webrtc/signaling/src/sdp/sipcc/sdp.h
@@ -185,16 +185,17 @@ typedef enum {
     SDP_TRANSPORT_TCP,
     SDP_TRANSPORT_RTPSAVPF,
     SDP_TRANSPORT_DTLSSCTP,
     SDP_TRANSPORT_RTPAVPF,
     SDP_TRANSPORT_UDPTLSRTPSAVP,
     SDP_TRANSPORT_UDPTLSRTPSAVPF,
     SDP_TRANSPORT_TCPTLSRTPSAVP,
     SDP_TRANSPORT_TCPTLSRTPSAVPF,
+    SDP_TRANSPORT_TCPDTLSRTPSAVPF,
     SDP_TRANSPORT_UDPDTLSSCTP,
     SDP_TRANSPORT_TCPDTLSSCTP,
     SDP_MAX_TRANSPORT_TYPES,
     SDP_TRANSPORT_UNSUPPORTED,
     SDP_TRANSPORT_INVALID
 } sdp_transport_e;
 
 
--- a/media/webrtc/signaling/src/sdp/sipcc/sdp_main.c
+++ b/media/webrtc/signaling/src/sdp/sipcc/sdp_main.c
@@ -266,16 +266,17 @@ const sdp_namearray_t sdp_transport[SDP_
     {"tcp",          sizeof("tcp")},
     {"RTP/SAVPF",    sizeof("RTP/SAVPF")},
     {"DTLS/SCTP",    sizeof("DTLS/SCTP")},
     {"RTP/AVPF",     sizeof("RTP/AVPF")},
     {"UDP/TLS/RTP/SAVP", sizeof("UDP/TLS/RTP/SAVP")},
     {"UDP/TLS/RTP/SAVPF", sizeof("UDP/TLS/RTP/SAVPF")},
     {"TCP/TLS/RTP/SAVP", sizeof("TCP/TLS/RTP/SAVP")},
     {"TCP/TLS/RTP/SAVPF", sizeof("TCP/TLS/RTP/SAVPF")},
+    {"TCP/DTLS/RTP/SAVPF", sizeof("TCP/DTLS/RTP/SAVPF")},
     {"UDP/DTLS/SCTP",    sizeof("UDP/DTLS/SCTP")},
     {"TCP/DTLS/SCTP",    sizeof("TCP/DTLS/SCTP")},
 };
 
 /* Note: These *must* be in the same order as the enum type. */
 const sdp_namearray_t sdp_encrypt[SDP_MAX_ENCRYPT_TYPES] =
 {
     {"clear",        sizeof("clear")},