Chromium Code Reviews| Index: webrtc/pc/mediasession.cc |
| diff --git a/webrtc/pc/mediasession.cc b/webrtc/pc/mediasession.cc |
| index 6b05736f0a3f3e74d662bb305e2458b7b7eba8ed..d0daff1ff9d77f9f95cecb758b3c67909a382488 100644 |
| --- a/webrtc/pc/mediasession.cc |
| +++ b/webrtc/pc/mediasession.cc |
| @@ -1115,9 +1115,22 @@ static bool CreateMediaContentAnswer( |
| return true; |
| } |
| +static bool IsProtocolFound(const std::vector<std::string> protocols, |
|
tommi
2016/04/14 12:59:09
Maybe this is by accident - but please don't pass
pthatcher1
2016/04/14 19:31:08
Good catch.
|
| + const std::string& protocol) { |
| + return std::find(protocols.begin(), protocols.end(), protocol) != |
| + protocols.end(); |
| +} |
| + |
| static bool IsMediaProtocolSupported(MediaType type, |
| const std::string& protocol, |
| bool secure_transport) { |
| + // The accepted pattern for media protocol (JSEP Section 5.1.3) |
| + const std::vector<std::string> kMediaProtocols = {"RTP/SAVPF", "RTP/SAVP", |
| + "RTP/AVPF", "RTP/AVP"}; |
|
tommi
2016/04/14 12:59:09
I don't think this needs to be std::vector. It co
pthatcher1
2016/04/14 19:31:08
Your idea of using static const char* is a good o
|
| + const std::vector<std::string> kMediaProtocolsDtls = { |
| + "UDP/TLS/RTP/SAVPF", "UDP/TLS/RTP/SAVP", "TCP/TLS/RTP/SAVPF", |
| + "TCP/TLS/RTP/SAVP"}; |
| + |
| // Data channels can have a protocol of SCTP or SCTP/DTLS. |
| if (type == MEDIA_TYPE_DATA && |
| ((protocol == kMediaProtocolSctp && !secure_transport)|| |
|
tommi
2016/04/14 12:59:09
check secure_transport first here and on the next
|
| @@ -1127,9 +1140,8 @@ static bool IsMediaProtocolSupported(MediaType type, |
| // Since not all applications serialize and deserialize the media protocol, |
|
tommi
2016/04/14 12:59:10
If type is MEDIA_TYPE_DATA when we get here, shoul
Taylor Brandstetter
2016/04/14 16:54:28
This is for RTP data channels, which some downstre
|
| // we will have to accept |protocol| to be empty. |
| - return protocol == kMediaProtocolAvpf || protocol.empty() || |
| - protocol == kMediaProtocolSavpf || |
| - (protocol == kMediaProtocolDtlsSavpf && secure_transport); |
| + return protocol.empty() || IsProtocolFound(kMediaProtocols, protocol) || |
|
tommi
2016/04/14 12:59:09
the |protocol.empty()| check should be done at the
|
| + (IsProtocolFound(kMediaProtocolsDtls, protocol) && secure_transport); |
|
tommi
2016/04/14 12:59:10
|secure_transport| should be checked before doing
Taylor Brandstetter
2016/04/14 16:54:28
Yes. JSEP says we should accept these protocols as
|
| } |
| static void SetMediaProtocol(bool secure_transport, |