ParseCandidate(): Refactor to fix memcheck false positive.
Also make supported protocols explicit in check.
Fix inconsistency where TLS_PROTOCOL_NAME was not exported.
BUG=webrtc:6885
Review-Url: https://codereview.webrtc.org/2570803003
Cr-Commit-Position: refs/heads/master@{#15577}
diff --git a/webrtc/api/webrtcsdp.cc b/webrtc/api/webrtcsdp.cc
index b700d85..f0e94b6 100644
--- a/webrtc/api/webrtcsdp.cc
+++ b/webrtc/api/webrtcsdp.cc
@@ -1034,10 +1034,18 @@
SocketAddress address(connection_address, port);
cricket::ProtocolType protocol;
- if (!StringToProto(transport.c_str(), &protocol) ||
- protocol == cricket::PROTO_TLS) {
+ if (!StringToProto(transport.c_str(), &protocol)) {
return ParseFailed(first_line, "Unsupported transport type.", error);
}
+ switch (protocol) {
+ case cricket::PROTO_UDP:
+ case cricket::PROTO_TCP:
+ case cricket::PROTO_SSLTCP:
+ // Supported protocol.
+ break;
+ default:
+ return ParseFailed(first_line, "Unsupported transport type.", error);
+ }
std::string candidate_type;
const std::string& type = fields[7];