Chromium Code Reviews| Index: third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp |
| diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp b/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp |
| index df9d88ec758b195311ddb78892e82de4f0d8d9d7..2ff2b9adae8d819db82eb01a0f5598e18d949996 100644 |
| --- a/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp |
| +++ b/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp |
| @@ -296,6 +296,7 @@ WebRTCConfiguration parseConfiguration(ExecutionContext* context, |
| String username = iceServer.username(); |
| String credential = iceServer.credential(); |
| + Vector<WebURL> urls; |
| for (const String& urlString : urlStrings) { |
| KURL url(KURL(), urlString); |
| if (!url.isValid()) { |
| @@ -318,8 +319,9 @@ WebRTCConfiguration parseConfiguration(ExecutionContext* context, |
| "required when the URL scheme is " |
| "\"turn\" or \"turns\"."); |
| } |
| - iceServers.push_back(WebRTCIceServer{url, username, credential}); |
| + urls.push_back(url); |
| } |
| + iceServers.push_back(WebRTCIceServer{urls, username, credential}); |
| } |
| webConfiguration.iceServers = iceServers; |
| } |
| @@ -338,6 +340,77 @@ WebRTCConfiguration parseConfiguration(ExecutionContext* context, |
| return webConfiguration; |
| } |
| +RTCConfiguration getWebKitRtcConfiguration(WebRTCConfiguration& blinkConfig) { |
| + RTCConfiguration rtcConfig; |
| + |
| + switch (blinkConfig.iceTransportPolicy) { |
| + case blink::WebRTCIceTransportPolicy::kNone: |
| + rtcConfig.setIceTransportPolicy("none"); |
| + break; |
| + case blink::WebRTCIceTransportPolicy::kRelay: |
| + rtcConfig.setIceTransportPolicy("relay"); |
| + break; |
| + case blink::WebRTCIceTransportPolicy::kAll: |
| + rtcConfig.setIceTransportPolicy("all"); |
| + break; |
| + default: |
|
Taylor_Brandstetter
2017/03/02 22:30:45
nit: Don't need any of the default cases in this f
|
| + NOTREACHED(); |
| + } |
| + |
| + switch (blinkConfig.bundlePolicy) { |
| + case blink::WebRTCBundlePolicy::kBalanced: |
| + rtcConfig.setBundlePolicy("balanced"); |
| + break; |
| + case blink::WebRTCBundlePolicy::kMaxBundle: |
| + rtcConfig.setBundlePolicy("max-bundle"); |
| + break; |
| + case blink::WebRTCBundlePolicy::kMaxCompat: |
| + rtcConfig.setBundlePolicy("max-compat"); |
| + break; |
| + default: |
| + NOTREACHED(); |
| + } |
| + |
| + switch (blinkConfig.rtcpMuxPolicy) { |
| + case blink::WebRTCRtcpMuxPolicy::kNegotiate: |
| + rtcConfig.setRtcpMuxPolicy("negotiate"); |
| + break; |
| + case blink::WebRTCRtcpMuxPolicy::kRequire: |
| + rtcConfig.setRtcpMuxPolicy("require"); |
| + break; |
| + default: |
| + NOTREACHED(); |
| + } |
| + |
| + HeapVector<RTCIceServer> servers; |
| + for (WebRTCIceServer blink_server : blinkConfig.iceServers) { |
| + RTCIceServer server; |
| + Vector<String> urlStrings; |
| + StringOrStringSequence urls; |
| + for (WebURL blink_url : blink_server.urls) { |
| + String urlString(blink_url.string().utf8().c_str()); |
| + urlStrings.push_back(urlString); |
| + } |
| + urls.setStringSequence(urlStrings); |
| + server.setURLs(urls); |
| + String username(blink_server.username.utf8().c_str()); |
| + server.setUsername(blink_server.username); |
| + String credential(blink_server.credential.utf8().c_str()); |
| + server.setCredential(credential); |
| + servers.push_back(server); |
| + } |
| + rtcConfig.setIceServers(servers); |
| + |
| + HeapVector<Member<RTCCertificate>> certificates; |
| + for (std::unique_ptr<blink::WebRTCCertificate>& blink_certificate : |
| + blinkConfig.certificates) { |
| + certificates.push_back(new RTCCertificate(std::move(blink_certificate))); |
| + } |
| + rtcConfig.setCertificates(certificates); |
| + |
| + return rtcConfig; |
| +} |
| + |
| RTCOfferOptionsPlatform* parseOfferOptions(const Dictionary& options, |
| ExceptionState& exceptionState) { |
| if (options.isUndefinedOrNull()) |
| @@ -793,6 +866,11 @@ RTCSessionDescription* RTCPeerConnection::remoteDescription() { |
| return RTCSessionDescription::create(webSessionDescription); |
| } |
| +void RTCPeerConnection::getConfiguration(RTCConfiguration& rtcConfig) { |
| + blink::WebRTCConfiguration blinkConfig = m_peerHandler->getConfiguration(); |
| + rtcConfig = getWebKitRtcConfiguration(blinkConfig); |
| +} |
| + |
| void RTCPeerConnection::setConfiguration( |
| ScriptState* scriptState, |
| const RTCConfiguration& rtcConfiguration, |