Bug 855769: add pref to disable TURN if needed r=ekr

This commit is contained in:
Randell Jesup 2013-03-30 21:52:19 -04:00
parent c61492423d
commit 4fe69a2fea
2 changed files with 15 additions and 3 deletions

View File

@ -19,6 +19,7 @@
#ifdef MOZILLA_INTERNAL_API
#include "MediaStreamList.h"
#include "nsIScriptGlobalObject.h"
#include "mozilla/Preferences.h"
#include "jsapi.h"
#endif
@ -137,9 +138,19 @@ nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_serv
CSFLogError(logTag, "%s: Failed to set stun servers", __FUNCTION__);
return rv;
}
if (NS_FAILED(rv = mIceCtx->SetTurnServers(turn_servers))) {
CSFLogError(logTag, "%s: Failed to set turn servers", __FUNCTION__);
return rv;
// Give us a way to globally turn off TURN support
#ifdef MOZILLA_INTERNAL_API
bool disabled = Preferences::GetBool("media.peerconnection.turn.disable", false);
#else
bool disabled = false;
#endif
if (!disabled) {
if (NS_FAILED(rv = mIceCtx->SetTurnServers(turn_servers))) {
CSFLogError(logTag, "%s: Failed to set turn servers", __FUNCTION__);
return rv;
}
} else if (turn_servers.size() != 0) {
CSFLogError(logTag, "%s: Setting turn servers disabled", __FUNCTION__);
}
if (NS_FAILED(rv = mDNSResolver->Init())) {
CSFLogError(logTag, "%s: Failed to initialize dns resolver", __FUNCTION__);

View File

@ -191,6 +191,7 @@ pref("media.peerconnection.use_document_iceservers", true);
// 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.
pref("media.peerconnection.turn.disable", false);
pref("media.peerconnection.aec_enabled", true);
pref("media.peerconnection.aec", 1);
pref("media.peerconnection.agc_enabled", false);