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

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

Issue 2055553003: Change the default rtcp mux policy from negotiate to require. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR comments Created 4 years 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 if (policy == "none") 222 if (policy == "none")
223 return WebRTCIceTransportPolicy::kNone; 223 return WebRTCIceTransportPolicy::kNone;
224 if (policy == "relay") 224 if (policy == "relay")
225 return WebRTCIceTransportPolicy::kRelay; 225 return WebRTCIceTransportPolicy::kRelay;
226 DCHECK_EQ(policy, "all"); 226 DCHECK_EQ(policy, "all");
227 return WebRTCIceTransportPolicy::kAll; 227 return WebRTCIceTransportPolicy::kAll;
228 } 228 }
229 229
230 WebRTCConfiguration parseConfiguration(ExecutionContext* context, 230 WebRTCConfiguration parseConfiguration(ExecutionContext* context,
231 const RTCConfiguration& configuration, 231 const RTCConfiguration& configuration,
232 ExceptionState& exceptionState, 232 ExceptionState& exceptionState) {
233 RtcpMuxPolicy* selectedRtcpMuxPolicy) {
234 DCHECK(context); 233 DCHECK(context);
235 DCHECK(selectedRtcpMuxPolicy);
236 234
237 WebRTCIceTransportPolicy iceTransportPolicy = WebRTCIceTransportPolicy::kAll; 235 WebRTCIceTransportPolicy iceTransportPolicy = WebRTCIceTransportPolicy::kAll;
238 if (configuration.hasIceTransportPolicy()) { 236 if (configuration.hasIceTransportPolicy()) {
239 UseCounter::count(context, UseCounter::RTCConfigurationIceTransportPolicy); 237 UseCounter::count(context, UseCounter::RTCConfigurationIceTransportPolicy);
240 iceTransportPolicy = 238 iceTransportPolicy =
241 iceTransportPolicyFromString(configuration.iceTransportPolicy()); 239 iceTransportPolicyFromString(configuration.iceTransportPolicy());
242 if (iceTransportPolicy == WebRTCIceTransportPolicy::kNone) { 240 if (iceTransportPolicy == WebRTCIceTransportPolicy::kNone) {
243 UseCounter::count(context, 241 UseCounter::count(context,
244 UseCounter::RTCConfigurationIceTransportPolicyNone); 242 UseCounter::RTCConfigurationIceTransportPolicyNone);
245 } 243 }
246 } else if (configuration.hasIceTransports()) { 244 } else if (configuration.hasIceTransports()) {
247 UseCounter::count(context, UseCounter::RTCConfigurationIceTransports); 245 UseCounter::count(context, UseCounter::RTCConfigurationIceTransports);
248 iceTransportPolicy = 246 iceTransportPolicy =
249 iceTransportPolicyFromString(configuration.iceTransports()); 247 iceTransportPolicyFromString(configuration.iceTransports());
250 if (iceTransportPolicy == WebRTCIceTransportPolicy::kNone) 248 if (iceTransportPolicy == WebRTCIceTransportPolicy::kNone)
251 UseCounter::count(context, UseCounter::RTCConfigurationIceTransportsNone); 249 UseCounter::count(context, UseCounter::RTCConfigurationIceTransportsNone);
252 } 250 }
253 251
254 WebRTCBundlePolicy bundlePolicy = WebRTCBundlePolicy::kBalanced; 252 WebRTCBundlePolicy bundlePolicy = WebRTCBundlePolicy::kBalanced;
255 String bundlePolicyString = configuration.bundlePolicy(); 253 String bundlePolicyString = configuration.bundlePolicy();
256 if (bundlePolicyString == "max-compat") { 254 if (bundlePolicyString == "max-compat") {
257 bundlePolicy = WebRTCBundlePolicy::kMaxCompat; 255 bundlePolicy = WebRTCBundlePolicy::kMaxCompat;
258 } else if (bundlePolicyString == "max-bundle") { 256 } else if (bundlePolicyString == "max-bundle") {
259 bundlePolicy = WebRTCBundlePolicy::kMaxBundle; 257 bundlePolicy = WebRTCBundlePolicy::kMaxBundle;
260 } else { 258 } else {
261 DCHECK_EQ(bundlePolicyString, "balanced"); 259 DCHECK_EQ(bundlePolicyString, "balanced");
262 } 260 }
263 261
264 // For the histogram value of "WebRTC.PeerConnection.SelectedRtcpMuxPolicy". 262 WebRTCRtcpMuxPolicy rtcpMuxPolicy = WebRTCRtcpMuxPolicy::kRequire;
265 *selectedRtcpMuxPolicy = RtcpMuxPolicyDefault; 263 String rtcpMuxPolicyString = configuration.rtcpMuxPolicy();
266 WebRTCRtcpMuxPolicy rtcpMuxPolicy = WebRTCRtcpMuxPolicy::kNegotiate; 264 if (rtcpMuxPolicyString == "negotiate") {
hbos_chromium 2016/12/15 15:12:06 This CL gives rtcpMuxPolicy a default value, but i
foolip 2016/12/15 15:26:03 If dictionary members have a default value, they c
hbos_chromium 2016/12/15 15:31:55 Oh cool!
267 if (configuration.hasRtcpMuxPolicy()) { 265 rtcpMuxPolicy = WebRTCRtcpMuxPolicy::kNegotiate;
268 String rtcpMuxPolicyString = configuration.rtcpMuxPolicy(); 266 } else {
269 if (rtcpMuxPolicyString == "require") { 267 DCHECK_EQ(rtcpMuxPolicyString, "require");
270 *selectedRtcpMuxPolicy = RtcpMuxPolicyRequire;
271 rtcpMuxPolicy = WebRTCRtcpMuxPolicy::kRequire;
272 } else {
273 DCHECK_EQ(rtcpMuxPolicyString, "negotiate");
274 *selectedRtcpMuxPolicy = RtcpMuxPolicyNegotiate;
275 }
276 } 268 }
277
278 WebRTCConfiguration webConfiguration; 269 WebRTCConfiguration webConfiguration;
279 webConfiguration.iceTransportPolicy = iceTransportPolicy; 270 webConfiguration.iceTransportPolicy = iceTransportPolicy;
280 webConfiguration.bundlePolicy = bundlePolicy; 271 webConfiguration.bundlePolicy = bundlePolicy;
281 webConfiguration.rtcpMuxPolicy = rtcpMuxPolicy; 272 webConfiguration.rtcpMuxPolicy = rtcpMuxPolicy;
282 273
283 if (configuration.hasIceServers()) { 274 if (configuration.hasIceServers()) {
284 Vector<WebRTCIceServer> iceServers; 275 Vector<WebRTCIceServer> iceServers;
285 for (const RTCIceServer& iceServer : configuration.iceServers()) { 276 for (const RTCIceServer& iceServer : configuration.iceServers()) {
286 Vector<String> urlStrings; 277 Vector<String> urlStrings;
287 if (iceServer.hasURLs()) { 278 if (iceServer.hasURLs()) {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 const RTCConfiguration& rtcConfiguration, 425 const RTCConfiguration& rtcConfiguration,
435 const Dictionary& mediaConstraints, 426 const Dictionary& mediaConstraints,
436 ExceptionState& exceptionState) { 427 ExceptionState& exceptionState) {
437 if (mediaConstraints.isObject()) 428 if (mediaConstraints.isObject())
438 UseCounter::count(context, 429 UseCounter::count(context,
439 UseCounter::RTCPeerConnectionConstructorConstraints); 430 UseCounter::RTCPeerConnectionConstructorConstraints);
440 else 431 else
441 UseCounter::count(context, 432 UseCounter::count(context,
442 UseCounter::RTCPeerConnectionConstructorCompliant); 433 UseCounter::RTCPeerConnectionConstructorCompliant);
443 434
444 // Record the RtcpMuxPolicy for histogram 435 WebRTCConfiguration configuration =
445 // "WebRTC.PeerConnection.SelectedRtcpMuxPolicy". 436 parseConfiguration(context, rtcConfiguration, exceptionState);
446 RtcpMuxPolicy selectedRtcpMuxPolicy = RtcpMuxPolicyDefault;
447 WebRTCConfiguration configuration = parseConfiguration(
448 context, rtcConfiguration, exceptionState, &selectedRtcpMuxPolicy);
449 if (exceptionState.hadException()) 437 if (exceptionState.hadException())
450 return 0; 438 return 0;
451 439
452 // Make sure no certificates have expired. 440 // Make sure no certificates have expired.
453 if (configuration.certificates.size() > 0) { 441 if (configuration.certificates.size() > 0) {
454 DOMTimeStamp now = convertSecondsToDOMTimeStamp(currentTime()); 442 DOMTimeStamp now = convertSecondsToDOMTimeStamp(currentTime());
455 for (const std::unique_ptr<WebRTCCertificate>& certificate : 443 for (const std::unique_ptr<WebRTCCertificate>& certificate :
456 configuration.certificates) { 444 configuration.certificates) {
457 DOMTimeStamp expires = certificate->expires(); 445 DOMTimeStamp expires = certificate->expires();
458 if (expires <= now) { 446 if (expires <= now) {
(...skipping 11 matching lines...) Expand all
470 mediaErrorState.raiseException(exceptionState); 458 mediaErrorState.raiseException(exceptionState);
471 return 0; 459 return 0;
472 } 460 }
473 461
474 RTCPeerConnection* peerConnection = new RTCPeerConnection( 462 RTCPeerConnection* peerConnection = new RTCPeerConnection(
475 context, configuration, constraints, exceptionState); 463 context, configuration, constraints, exceptionState);
476 peerConnection->suspendIfNeeded(); 464 peerConnection->suspendIfNeeded();
477 if (exceptionState.hadException()) 465 if (exceptionState.hadException())
478 return 0; 466 return 0;
479 467
480 peerConnection->m_peerHandler->logSelectedRtcpMuxPolicy(
481 selectedRtcpMuxPolicy);
482
483 return peerConnection; 468 return peerConnection;
484 } 469 }
485 470
486 RTCPeerConnection::RTCPeerConnection(ExecutionContext* context, 471 RTCPeerConnection::RTCPeerConnection(ExecutionContext* context,
487 const WebRTCConfiguration& configuration, 472 const WebRTCConfiguration& configuration,
488 WebMediaConstraints constraints, 473 WebMediaConstraints constraints,
489 ExceptionState& exceptionState) 474 ExceptionState& exceptionState)
490 : ActiveScriptWrappable(this), 475 : ActiveScriptWrappable(this),
491 SuspendableObject(context), 476 SuspendableObject(context),
492 m_signalingState(SignalingStateStable), 477 m_signalingState(SignalingStateStable),
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 return RTCSessionDescription::create(webSessionDescription); 790 return RTCSessionDescription::create(webSessionDescription);
806 } 791 }
807 792
808 void RTCPeerConnection::updateIce(ExecutionContext* context, 793 void RTCPeerConnection::updateIce(ExecutionContext* context,
809 const RTCConfiguration& rtcConfiguration, 794 const RTCConfiguration& rtcConfiguration,
810 const Dictionary&, 795 const Dictionary&,
811 ExceptionState& exceptionState) { 796 ExceptionState& exceptionState) {
812 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) 797 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState))
813 return; 798 return;
814 799
815 RtcpMuxPolicy selectedRtcpMuxPolicy = RtcpMuxPolicyDefault; 800 WebRTCConfiguration configuration =
816 WebRTCConfiguration configuration = parseConfiguration( 801 parseConfiguration(context, rtcConfiguration, exceptionState);
817 context, rtcConfiguration, exceptionState, &selectedRtcpMuxPolicy);
818 802
819 if (exceptionState.hadException()) 803 if (exceptionState.hadException())
820 return; 804 return;
821 805
822 MediaErrorState mediaErrorState; 806 MediaErrorState mediaErrorState;
823 if (mediaErrorState.hadException()) { 807 if (mediaErrorState.hadException()) {
824 mediaErrorState.raiseException(exceptionState); 808 mediaErrorState.raiseException(exceptionState);
825 return; 809 return;
826 } 810 }
827 811
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 DEFINE_TRACE(RTCPeerConnection) { 1473 DEFINE_TRACE(RTCPeerConnection) {
1490 visitor->trace(m_localStreams); 1474 visitor->trace(m_localStreams);
1491 visitor->trace(m_remoteStreams); 1475 visitor->trace(m_remoteStreams);
1492 visitor->trace(m_dispatchScheduledEventRunner); 1476 visitor->trace(m_dispatchScheduledEventRunner);
1493 visitor->trace(m_scheduledEvents); 1477 visitor->trace(m_scheduledEvents);
1494 EventTargetWithInlineData::trace(visitor); 1478 EventTargetWithInlineData::trace(visitor);
1495 SuspendableObject::trace(visitor); 1479 SuspendableObject::trace(visitor);
1496 } 1480 }
1497 1481
1498 } // namespace blink 1482 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698