| Index: webrtc/pc/mediasession.cc
|
| diff --git a/webrtc/pc/mediasession.cc b/webrtc/pc/mediasession.cc
|
| index 6b05736f0a3f3e74d662bb305e2458b7b7eba8ed..b077e0f83ff9e2146ebeb4a925764b3d2a379bff 100644
|
| --- a/webrtc/pc/mediasession.cc
|
| +++ b/webrtc/pc/mediasession.cc
|
| @@ -1115,21 +1115,55 @@ 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) {
|
| - // Data channels can have a protocol of SCTP or SCTP/DTLS.
|
| - if (type == MEDIA_TYPE_DATA &&
|
| - ((protocol == kMediaProtocolSctp && !secure_transport)||
|
| - (protocol == kMediaProtocolDtlsSctp && secure_transport))) {
|
| + // Since not all applications serialize and deserialize the media protocol,
|
| + // we will have to accept |protocol| to be empty.
|
| + if (protocol.empty()) {
|
| return true;
|
| }
|
|
|
| - // Since not all applications serialize and deserialize the media protocol,
|
| - // we will have to accept |protocol| to be empty.
|
| - return protocol == kMediaProtocolAvpf || protocol.empty() ||
|
| - protocol == kMediaProtocolSavpf ||
|
| - (protocol == kMediaProtocolDtlsSavpf && secure_transport);
|
| + if (type == MEDIA_TYPE_DATA) {
|
| + // Check for SCTP, but also for RTP for RTP-based data channels.
|
| + // TODO(pthatcher): Remove RTP once RTP-based data channels are gone.
|
| + if (secure_transport) {
|
| + // Most likely scenarios first.
|
| + return IsDtlsSctp(protocol) || IsDtlsRtp(protocol) ||
|
| + IsPlainRtp(protocol);
|
| + } else {
|
| + return IsPlainSctp(protocol) || IsPlainRtp(protocol);
|
| + }
|
| + }
|
| +
|
| + // Allow for non-DTLS RTP protocol even when using DTLS because that's what
|
| + // JSEP specifies.
|
| + if (secure_transport) {
|
| + // Most likely scenarios first.
|
| + return IsDtlsRtp(protocol) || IsPlainRtp(protocol);
|
| + } else {
|
| + return IsPlainRtp(protocol);
|
| + }
|
| }
|
|
|
| static void SetMediaProtocol(bool secure_transport,
|
|
|