Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: webrtc/pc/iceserverparsing.cc

Issue 2926823003: Allow passing both hostname and IP of ICE server into PeerConnection. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/p2p/base/portallocator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/iceserverparsing.cc
diff --git a/webrtc/pc/iceserverparsing.cc b/webrtc/pc/iceserverparsing.cc
index 5769cee94e270e1448f139992c3833dc411d6a54..ac8764e0363a7683a4fc9ca83609b4291fd1bb7e 100644
--- a/webrtc/pc/iceserverparsing.cc
+++ b/webrtc/pc/iceserverparsing.cc
@@ -210,8 +210,8 @@ static RTCErrorType ParseIceServerUrl(
turn_transport_type = cricket::PROTO_TLS;
}
- std::string address;
- if (!ParseHostnameAndPortFromString(hoststring, &address, &port)) {
+ std::string hostname;
+ if (!ParseHostnameAndPortFromString(hoststring, &hostname, &port)) {
LOG(WARNING) << "Invalid hostname format: " << uri_without_transport;
return RTCErrorType::SYNTAX_ERROR;
}
@@ -220,11 +220,18 @@ static RTCErrorType ParseIceServerUrl(
LOG(WARNING) << "Invalid port: " << port;
return RTCErrorType::SYNTAX_ERROR;
}
+ rtc::SocketAddress address(hostname, port);
+ if (!server.ip.IsNil()) {
+ if (!address.IsUnresolvedIP() && address.ipaddr() != server.ip) {
+ return RTCErrorType::INVALID_PARAMETER;
+ }
+ address.SetResolvedIP(server.ip);
+ }
switch (service_type) {
case STUN:
case STUNS:
- stun_servers->insert(rtc::SocketAddress(address, port));
+ stun_servers->insert(address);
break;
case TURN:
case TURNS: {
@@ -234,7 +241,7 @@ static RTCErrorType ParseIceServerUrl(
return RTCErrorType::INVALID_PARAMETER;
}
cricket::RelayServerConfig config = cricket::RelayServerConfig(
- address, port, username, server.password, turn_transport_type);
+ address, username, server.password, turn_transport_type);
if (server.tls_cert_policy ==
PeerConnectionInterface::kTlsCertPolicyInsecureNoCheck) {
config.tls_cert_policy =
« no previous file with comments | « webrtc/p2p/base/portallocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698