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

Side by Side Diff: third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp

Issue 2447033002: Support RTCConfiguration iceTransportPolicy (Closed)
Patch Set: update expectations Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 211
212 void onSuccess(std::unique_ptr<WebRTCCertificate> certificate) override { 212 void onSuccess(std::unique_ptr<WebRTCCertificate> certificate) override {
213 m_resolver->resolve(new RTCCertificate(std::move(certificate))); 213 m_resolver->resolve(new RTCCertificate(std::move(certificate)));
214 } 214 }
215 215
216 void onError() override { m_resolver->reject(); } 216 void onError() override { m_resolver->reject(); }
217 217
218 Persistent<ScriptPromiseResolver> m_resolver; 218 Persistent<ScriptPromiseResolver> m_resolver;
219 }; 219 };
220 220
221 WebRTCIceTransportPolicy iceTransportPolicyFromString(const String& policy) {
222 if (policy == "none")
223 return WebRTCIceTransportPolicy::kNone;
224 if (policy == "relay")
225 return WebRTCIceTransportPolicy::kRelay;
226 DCHECK_EQ(policy, "all");
227 return WebRTCIceTransportPolicy::kAll;
228 }
229
221 WebRTCConfiguration parseConfiguration(ExecutionContext* context, 230 WebRTCConfiguration parseConfiguration(ExecutionContext* context,
222 const RTCConfiguration& configuration, 231 const RTCConfiguration& configuration,
223 ExceptionState& exceptionState, 232 ExceptionState& exceptionState,
224 RtcpMuxPolicy* selectedRtcpMuxPolicy) { 233 RtcpMuxPolicy* selectedRtcpMuxPolicy) {
225 DCHECK(context); 234 DCHECK(context);
226 DCHECK(selectedRtcpMuxPolicy); 235 DCHECK(selectedRtcpMuxPolicy);
227 236
228 WebRTCIceTransports iceTransports = WebRTCIceTransports::kAll; 237 WebRTCIceTransportPolicy iceTransportPolicy = WebRTCIceTransportPolicy::kAll;
229 String iceTransportsString = configuration.iceTransports(); 238 if (configuration.hasIceTransportPolicy()) {
230 if (iceTransportsString == "none") { 239 UseCounter::count(context, UseCounter::RTCConfigurationIceTransportPolicy);
231 UseCounter::count(context, UseCounter::RTCConfigurationIceTransportsNone); 240 iceTransportPolicy =
232 iceTransports = WebRTCIceTransports::kNone; 241 iceTransportPolicyFromString(configuration.iceTransportPolicy());
233 } else if (iceTransportsString == "relay") { 242 if (iceTransportPolicy == WebRTCIceTransportPolicy::kNone) {
234 iceTransports = WebRTCIceTransports::kRelay; 243 UseCounter::count(context,
235 } else { 244 UseCounter::RTCConfigurationIceTransportPolicyNone);
236 DCHECK_EQ(iceTransportsString, "all"); 245 }
246 } else if (configuration.hasIceTransports()) {
247 UseCounter::count(context, UseCounter::RTCConfigurationIceTransports);
248 iceTransportPolicy =
249 iceTransportPolicyFromString(configuration.iceTransports());
250 if (iceTransportPolicy == WebRTCIceTransportPolicy::kNone)
251 UseCounter::count(context, UseCounter::RTCConfigurationIceTransportsNone);
237 } 252 }
238 253
239 WebRTCBundlePolicy bundlePolicy = WebRTCBundlePolicy::kBalanced; 254 WebRTCBundlePolicy bundlePolicy = WebRTCBundlePolicy::kBalanced;
240 String bundlePolicyString = configuration.bundlePolicy(); 255 String bundlePolicyString = configuration.bundlePolicy();
241 if (bundlePolicyString == "max-compat") { 256 if (bundlePolicyString == "max-compat") {
242 bundlePolicy = WebRTCBundlePolicy::kMaxCompat; 257 bundlePolicy = WebRTCBundlePolicy::kMaxCompat;
243 } else if (bundlePolicyString == "max-bundle") { 258 } else if (bundlePolicyString == "max-bundle") {
244 bundlePolicy = WebRTCBundlePolicy::kMaxBundle; 259 bundlePolicy = WebRTCBundlePolicy::kMaxBundle;
245 } else { 260 } else {
246 DCHECK_EQ(bundlePolicyString, "balanced"); 261 DCHECK_EQ(bundlePolicyString, "balanced");
247 } 262 }
248 263
249 // For the histogram value of "WebRTC.PeerConnection.SelectedRtcpMuxPolicy". 264 // For the histogram value of "WebRTC.PeerConnection.SelectedRtcpMuxPolicy".
250 *selectedRtcpMuxPolicy = RtcpMuxPolicyDefault; 265 *selectedRtcpMuxPolicy = RtcpMuxPolicyDefault;
251 WebRTCRtcpMuxPolicy rtcpMuxPolicy = WebRTCRtcpMuxPolicy::kNegotiate; 266 WebRTCRtcpMuxPolicy rtcpMuxPolicy = WebRTCRtcpMuxPolicy::kNegotiate;
252 if (configuration.hasRtcpMuxPolicy()) { 267 if (configuration.hasRtcpMuxPolicy()) {
253 String rtcpMuxPolicyString = configuration.rtcpMuxPolicy(); 268 String rtcpMuxPolicyString = configuration.rtcpMuxPolicy();
254 if (rtcpMuxPolicyString == "require") { 269 if (rtcpMuxPolicyString == "require") {
255 *selectedRtcpMuxPolicy = RtcpMuxPolicyRequire; 270 *selectedRtcpMuxPolicy = RtcpMuxPolicyRequire;
256 rtcpMuxPolicy = WebRTCRtcpMuxPolicy::kRequire; 271 rtcpMuxPolicy = WebRTCRtcpMuxPolicy::kRequire;
257 } else { 272 } else {
258 DCHECK_EQ(rtcpMuxPolicyString, "negotiate"); 273 DCHECK_EQ(rtcpMuxPolicyString, "negotiate");
259 *selectedRtcpMuxPolicy = RtcpMuxPolicyNegotiate; 274 *selectedRtcpMuxPolicy = RtcpMuxPolicyNegotiate;
260 } 275 }
261 } 276 }
262 277
263 WebRTCConfiguration webConfiguration; 278 WebRTCConfiguration webConfiguration;
264 webConfiguration.iceTransports = iceTransports; 279 webConfiguration.iceTransportPolicy = iceTransportPolicy;
265 webConfiguration.bundlePolicy = bundlePolicy; 280 webConfiguration.bundlePolicy = bundlePolicy;
266 webConfiguration.rtcpMuxPolicy = rtcpMuxPolicy; 281 webConfiguration.rtcpMuxPolicy = rtcpMuxPolicy;
267 282
268 if (configuration.hasIceServers()) { 283 if (configuration.hasIceServers()) {
269 Vector<WebRTCIceServer> iceServers; 284 Vector<WebRTCIceServer> iceServers;
270 for (const RTCIceServer& iceServer : configuration.iceServers()) { 285 for (const RTCIceServer& iceServer : configuration.iceServers()) {
271 Vector<String> urlStrings; 286 Vector<String> urlStrings;
272 if (iceServer.hasURLs()) { 287 if (iceServer.hasURLs()) {
273 UseCounter::count(context, UseCounter::RTCIceServerURLs); 288 UseCounter::count(context, UseCounter::RTCIceServerURLs);
274 const StringOrStringSequence& urls = iceServer.urls(); 289 const StringOrStringSequence& urls = iceServer.urls();
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1452 DEFINE_TRACE(RTCPeerConnection) { 1467 DEFINE_TRACE(RTCPeerConnection) {
1453 visitor->trace(m_localStreams); 1468 visitor->trace(m_localStreams);
1454 visitor->trace(m_remoteStreams); 1469 visitor->trace(m_remoteStreams);
1455 visitor->trace(m_dispatchScheduledEventRunner); 1470 visitor->trace(m_dispatchScheduledEventRunner);
1456 visitor->trace(m_scheduledEvents); 1471 visitor->trace(m_scheduledEvents);
1457 EventTargetWithInlineData::trace(visitor); 1472 EventTargetWithInlineData::trace(visitor);
1458 ActiveDOMObject::trace(visitor); 1473 ActiveDOMObject::trace(visitor);
1459 } 1474 }
1460 1475
1461 } // namespace blink 1476 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698