From b8a465e5da171472f18bd251d149d4692fdc3562 Mon Sep 17 00:00:00 2001 From: "Byron Campen [:bwc]" Date: Fri, 22 May 2015 11:11:37 -0700 Subject: [PATCH] Bug 1169338 - Part 2: Extend ICE timeouts since mochitests are frequently run on systems that are performance constrained. r=mt --- dom/media/tests/mochitest/head.js | 2 ++ dom/media/tests/mochitest/pc.js | 2 +- media/mtransport/nricectx.cpp | 27 +++++++++++++++++++++++++-- modules/libpref/init/all.js | 3 ++- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/dom/media/tests/mochitest/head.js b/dom/media/tests/mochitest/head.js index 0bc06fd5f5e..521a40879bc 100644 --- a/dom/media/tests/mochitest/head.js +++ b/dom/media/tests/mochitest/head.js @@ -135,6 +135,8 @@ function setupEnvironment() { ['media.peerconnection.enabled', true], ['media.peerconnection.identity.enabled', true], ['media.peerconnection.identity.timeout', 12000], + ['media.peerconnection.ice.stun_client_maximum_transmits', 14], + ['media.peerconnection.ice.trickle_grace_period', 30000], ['media.navigator.permission.disabled', true], ['media.getusermedia.screensharing.enabled', true], ['media.getusermedia.screensharing.allowed_domains', "mochi.test"] diff --git a/dom/media/tests/mochitest/pc.js b/dom/media/tests/mochitest/pc.js index f6836d53df2..1e979b277cc 100644 --- a/dom/media/tests/mochitest/pc.js +++ b/dom/media/tests/mochitest/pc.js @@ -615,7 +615,7 @@ function DataChannelWrapper(dataChannel, peerConnectionWrapper) { is(this.readyState, "open", "data channel is 'open' after 'onopen'"); resolve(this); }; - }), 60000, "channel didn't open in time"); + }), 180000, "channel didn't open in time"); } DataChannelWrapper.prototype = { diff --git a/media/mtransport/nricectx.cpp b/media/mtransport/nricectx.cpp index 7edbc0ef948..cfac62783c3 100644 --- a/media/mtransport/nricectx.cpp +++ b/media/mtransport/nricectx.cpp @@ -61,6 +61,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "nsServiceManagerUtils.h" #include "ScopedNSSTypes.h" #include "runnable_utils.h" +#include "nsIPrefService.h" +#include "nsIPrefBranch.h" // nICEr includes extern "C" { @@ -434,8 +436,29 @@ RefPtr NrIceCtx::Create(const std::string& name, NR_reg_set_uchar((char *)"ice.pref.interface.wlan0", 232); } - NR_reg_set_uint4((char *)"stun.client.maximum_transmits",7); - NR_reg_set_uint4((char *)NR_ICE_REG_TRICKLE_GRACE_PERIOD, 5000); + int32_t stun_client_maximum_transmits = 7; + int32_t ice_trickle_grace_period = 5000; +#ifndef MOZILLA_XPCOMRT_API + nsresult res; + nsCOMPtr prefs = + do_GetService("@mozilla.org/preferences-service;1", &res); + + if (NS_SUCCEEDED(res)) { + nsCOMPtr branch = do_QueryInterface(prefs); + if (branch) { + branch->GetIntPref( + "media.peerconnection.ice.stun_client_maximum_transmits", + &stun_client_maximum_transmits); + branch->GetIntPref( + "media.peerconnection.ice.trickle_grace_period", + &ice_trickle_grace_period); + } + } +#endif + NR_reg_set_uint4((char *)"stun.client.maximum_transmits", + stun_client_maximum_transmits); + NR_reg_set_uint4((char *)NR_ICE_REG_TRICKLE_GRACE_PERIOD, + ice_trickle_grace_period); if (allow_loopback) { NR_reg_set_char((char *)NR_STUN_REG_PREF_ALLOW_LOOPBACK_ADDRS, 1); diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index cf753908c97..b581ff795d8 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -375,7 +375,8 @@ pref("media.peerconnection.ice.loopback", false); // Set only for testing in off pref("media.peerconnection.use_document_iceservers", true); pref("media.peerconnection.identity.enabled", true); pref("media.peerconnection.identity.timeout", 10000); -pref("media.peerconnection.ice.loopback", false); // Set only for testing in offline environments. +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.