Bug 1189030 - Add pref "media.peerconnection.ice.relay_only" (default=false) draft
authorJan-Ivar Bruaroey <jib@mozilla.com>
Thu, 30 Jul 2015 10:48:27 -0400
changeset 282109 99616b090dcdd7814800b79ef6566b76888bc0e5
parent 282108 aac97c23c1ece2bd08d01bc4c79f5a7af4c4cce3
child 507920 d5acb2ccb27cf562c0f1da7776d007c7898beebb
push id3949
push userjbruaroey@mozilla.com
push dateFri, 31 Jul 2015 05:25:22 +0000
bugs1189030
milestone42.0a1
Bug 1189030 - Add pref "media.peerconnection.ice.relay_only" (default=false)
dom/media/PeerConnection.js
modules/libpref/init/all.js
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -318,16 +318,22 @@ RTCPeerConnection.prototype = {
   contractID: PC_CONTRACT,
   QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
                                          Ci.nsIDOMGlobalPropertyInitializer]),
   init: function(win) { this._win = win; },
 
   __init: function(rtcConfig) {
     this._winID = this._win.QueryInterface(Ci.nsIInterfaceRequestor)
     .getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
+    // TODO: Update this code once we support pc.setConfiguration, to track
+    // setting from content independently from pref (Bug 1181768).
+    if (rtcConfig.iceTransportPolicy == "all" &&
+        Services.prefs.getBoolPref("media.peerconnection.ice.relay_only")) {
+      rtcConfig.iceTransportPolicy = "relay";
+    }
     if (!rtcConfig.iceServers ||
         !Services.prefs.getBoolPref("media.peerconnection.use_document_iceservers")) {
       try {
          rtcConfig.iceServers =
            JSON.parse(Services.prefs.getCharPref("media.peerconnection.default_iceservers") || "[]");
       } catch (e) {
         this.logWarning(
             "Ignoring invalid media.peerconnection.default_iceservers in about:config",
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -391,16 +391,17 @@ pref("media.peerconnection.video.min_bit
 pref("media.peerconnection.video.start_bitrate", 300);
 pref("media.peerconnection.video.max_bitrate", 2000);
 #endif
 pref("media.navigator.permission.disabled", false);
 pref("media.peerconnection.default_iceservers", "[]");
 pref("media.peerconnection.ice.loopback", false); // Set only for testing in offline environments.
 pref("media.peerconnection.ice.tcp", false);
 pref("media.peerconnection.ice.link_local", false); // Set only for testing IPV6 in networks that don't assign IPV6 addresses
+pref("media.peerconnection.ice.relay_only", false); // Limit candidates to TURN
 pref("media.peerconnection.use_document_iceservers", true);
 pref("media.peerconnection.identity.enabled", true);
 pref("media.peerconnection.identity.timeout", 10000);
 pref("media.peerconnection.ice.stun_client_maximum_transmits", 7);
 pref("media.peerconnection.ice.trickle_grace_period", 5000);
 // These values (aec, agc, and noice) are from media/webrtc/trunk/webrtc/common_types.h
 // kXxxUnchanged = 0, kXxxDefault = 1, and higher values are specific to each
 // setting (for Xxx = Ec, Agc, or Ns).  Defaults are all set to kXxxDefault here.