Chromium Code Reviews| Index: webrtc/pc/mediasession.cc | 
| diff --git a/webrtc/pc/mediasession.cc b/webrtc/pc/mediasession.cc | 
| index a9d1b95c22aee6aae9299315a9ecc05586242336..382cdbc44fde55aa251ff5b5f698d39e424be764 100644 | 
| --- a/webrtc/pc/mediasession.cc | 
| +++ b/webrtc/pc/mediasession.cc | 
| @@ -57,6 +57,13 @@ const char kMediaProtocolAvpf[] = "RTP/AVPF"; | 
| // RFC5124 | 
| const char kMediaProtocolDtlsSavpf[] = "UDP/TLS/RTP/SAVPF"; | 
| +// 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"}; | 
| 
 
Avi (use Gerrit)
2016/04/13 17:42:05
This is a static initializer.
 
 | 
| +const std::vector<std::string> kMediaProtocolsDtls = { | 
| + "UDP/TLS/RTP/SAVPF", "UDP/TLS/RTP/SAVP", "TCP/TLS/RTP/SAVPF", | 
| + "TCP/TLS/RTP/SAVP"}; | 
| 
 
Avi (use Gerrit)
2016/04/13 17:42:05
This is a static initializer.
 
 | 
| + | 
| // We always generate offers with "UDP/TLS/RTP/SAVPF" when using DTLS-SRTP, | 
| // but we tolerate "RTP/SAVPF" in offers we receive, for compatibility. | 
| const char kMediaProtocolSavpf[] = "RTP/SAVPF"; | 
| @@ -1105,6 +1112,12 @@ static bool CreateMediaContentAnswer( | 
| return true; | 
| } | 
| +static bool IsProtocolFound(const std::vector<std::string> protocols, | 
| + 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) { | 
| @@ -1117,9 +1130,8 @@ static bool IsMediaProtocolSupported(MediaType type, | 
| // 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); | 
| + return protocol.empty() || IsProtocolFound(kMediaProtocols, protocol) || | 
| + (IsProtocolFound(kMediaProtocolsDtls, protocol) && secure_transport); | 
| } | 
| static void SetMediaProtocol(bool secure_transport, |