Index: webrtc/pc/mediasession.cc |
diff --git a/webrtc/pc/mediasession.cc b/webrtc/pc/mediasession.cc |
index 34ccdce7756b343d7c4ceb2cdc60aee2e1f986bf..1b7b26a0c71a0ddca4be96c42b03963a4f1e12a9 100644 |
--- a/webrtc/pc/mediasession.cc |
+++ b/webrtc/pc/mediasession.cc |
@@ -67,6 +67,36 @@ const char kMediaProtocolDtlsSctp[] = "DTLS/SCTP"; |
const char kMediaProtocolUdpDtlsSctp[] = "UDP/DTLS/SCTP"; |
const char kMediaProtocolTcpDtlsSctp[] = "TCP/DTLS/SCTP"; |
+// Note that the below functions support some protocol strings purely for |
+// legacy compatibility, as required by JSEP in Section 5.1.2, Profile Names |
+// and Interoperability. |
+ |
+static bool IsDtlsRtp(const std::string& protocol) { |
+ // Most-likely values first. |
+ return protocol == "UDP/TLS/RTP/SAVPF" || protocol == "TCP/TLS/RTP/SAVPF" || |
+ protocol == "UDP/TLS/RTP/SAVP" || protocol == "TCP/TLS/RTP/SAVP"; |
+} |
+ |
+static bool IsPlainRtp(const std::string& protocol) { |
+ // Most-likely values first. |
+ return protocol == "RTP/SAVPF" || protocol == "RTP/AVPF" || |
+ protocol == "RTP/SAVP" || protocol == "RTP/AVP"; |
+} |
+ |
+static bool IsDtlsSctp(const std::string& protocol) { |
+ return protocol == kMediaProtocolDtlsSctp || |
+ protocol == kMediaProtocolUdpDtlsSctp || |
+ protocol == kMediaProtocolTcpDtlsSctp; |
Taylor Brandstetter
2017/05/24 17:43:21
This is the only method that was changed and not j
|
+} |
+ |
+static bool IsPlainSctp(const std::string& protocol) { |
+ return protocol == kMediaProtocolSctp; |
+} |
+ |
+static bool IsSctp(const std::string& protocol) { |
+ return IsPlainSctp(protocol) || IsDtlsSctp(protocol); |
+} |
+ |
RtpTransceiverDirection RtpTransceiverDirection::FromMediaContentDirection( |
MediaContentDirection md) { |
const bool send = (md == MD_SENDRECV || md == MD_SENDONLY); |
@@ -398,11 +428,6 @@ class UsedRtpHeaderExtensionIds : public UsedIds<webrtc::RtpExtension> { |
private: |
}; |
-static bool IsSctp(const MediaContentDescription* desc) { |
- return ((desc->protocol() == kMediaProtocolSctp) || |
- (desc->protocol() == kMediaProtocolDtlsSctp)); |
-} |
- |
// Adds a StreamParams for each Stream in Streams with media type |
// media_type to content_description. |
// |current_params| - All currently known StreamParams of any media type. |
@@ -413,7 +438,7 @@ static bool AddStreamParams(MediaType media_type, |
MediaContentDescriptionImpl<C>* content_description, |
const bool add_legacy_stream) { |
// SCTP streams are not negotiated using SDP/ContentDescriptions. |
- if (IsSctp(content_description)) { |
+ if (IsSctp(content_description->protocol())) { |
return true; |
} |
@@ -1085,26 +1110,6 @@ static bool CreateMediaContentAnswer( |
return true; |
} |
-static bool IsDtlsRtp(const std::string& protocol) { |
- // Most-likely values first. |
- return protocol == "UDP/TLS/RTP/SAVPF" || protocol == "TCP/TLS/RTP/SAVPF" || |
- protocol == "UDP/TLS/RTP/SAVP" || protocol == "TCP/TLS/RTP/SAVP"; |
-} |
- |
-static bool IsPlainRtp(const std::string& protocol) { |
- // Most-likely values first. |
- return protocol == "RTP/SAVPF" || protocol == "RTP/AVPF" || |
- protocol == "RTP/SAVP" || protocol == "RTP/AVP"; |
-} |
- |
-static bool IsDtlsSctp(const std::string& protocol) { |
- return protocol == "DTLS/SCTP"; |
-} |
- |
-static bool IsPlainSctp(const std::string& protocol) { |
- return protocol == "SCTP"; |
-} |
- |
static bool IsMediaProtocolSupported(MediaType type, |
const std::string& protocol, |
bool secure_transport) { |
@@ -1357,8 +1362,8 @@ SessionDescription* MediaSessionDescriptionFactory::CreateOffer( |
video_added = true; |
} else if (IsMediaContentOfType(&*it, MEDIA_TYPE_DATA)) { |
MediaSessionOptions options_copy(options); |
- if (IsSctp(static_cast<const MediaContentDescription*>( |
- it->description))) { |
+ if (IsSctp(static_cast<const MediaContentDescription*>(it->description) |
+ ->protocol())) { |
options_copy.data_channel_type = DCT_SCTP; |
} |
if (!AddDataContentForOffer(options_copy, current_description, |
@@ -1797,6 +1802,7 @@ bool MediaSessionDescriptionFactory::AddDataContentForOffer( |
// before we call CreateMediaContentOffer. Otherwise, |
// CreateMediaContentOffer won't know this is SCTP and will |
// generate SSRCs rather than SIDs. |
+ // TODO(deadbeef): Use kMediaProtocolDtls |
data->set_protocol( |
secure_transport ? kMediaProtocolDtlsSctp : kMediaProtocolSctp); |
} else { |