Merge pull request #1710 from saghul/p2p-settings

feat(p2p): refactor configuration options
This commit is contained in:
George Politis 2017-06-29 11:13:26 +02:00 committed by GitHub
commit 2b0563ad35
2 changed files with 41 additions and 39 deletions

View File

@ -20,13 +20,6 @@ var config = { // eslint-disable-line no-unused-vars
//focusUserJid: 'focus@auth.jitsi-meet.example.com', // The real JID of focus participant - can be overridden here
//defaultSipNumber: '', // Default SIP number
// The STUN servers that will be used in the peer to peer connections
p2pStunServers: [
{ urls: "stun:stun.l.google.com:19302" },
{ urls: "stun:stun1.l.google.com:19302" },
{ urls: "stun:stun2.l.google.com:19302" }
],
// The ID of the jidesha extension for Chrome.
desktopSharingChromeExtId: null,
// Whether desktop sharing should be disabled on Chrome.
@ -92,13 +85,26 @@ var config = { // eslint-disable-line no-unused-vars
disableRtx: false,
// Sets the preferred resolution (height) for local video. Defaults to 720.
resolution: 720,
// Enables peer to peer mode. When enabled system will try to establish
// direct connection given that there are exactly 2 participants in
// the room. If that succeeds the conference will stop sending data through
// the JVB and use the peer to peer connection instead. When 3rd participant
// joins the conference will be moved back to the JVB connection.
enableP2P: true
// How long we're going to wait, before going back to P2P after
// the 3rd participant has left the conference (to filter out page reload)
//backToP2PDelay: 5
// Peer-To-Peer mode: used (if enabled) when there are just 2 participants.
p2p: {
// Enables peer to peer mode. When enabled system will try to establish
// direct connection given that there are exactly 2 participants in
// the room. If that succeeds the conference will stop sending data
// through the JVB and use the peer to peer connection instead. When 3rd
// participant joins the conference will be moved back to the JVB
// connection.
enabled: true,
// The STUN servers that will be used in the peer to peer connections
stunServers: [
{ urls: "stun:stun.l.google.com:19302" },
{ urls: "stun:stun1.l.google.com:19302" },
{ urls: "stun:stun2.l.google.com:19302" }
],
// If set to true, it will prefer to use H.264 for P2P calls (if H.264
// is supported).
preferH264: false
// How long we're going to wait, before going back to P2P after
// the 3rd participant has left the conference (to filter out page reload)
//backToP2PDelay: 5
}
};

View File

@ -1,6 +1,7 @@
/* @flow */
import JSSHA from 'jssha';
import _ from 'lodash';
import parseURLParams from './parseURLParams';
@ -172,17 +173,11 @@ export function overrideConfigJSON(
if (configObj) {
const configJSON = json[configName];
for (const key of Object.keys(configJSON)) {
const oldValue = configObj[key];
const newValue = configJSON[key];
if (oldValue && typeof oldValue !== typeof newValue) {
logger.log(
`Overriding a ${configName
} property with a property of different type.`);
}
logger.info(`Overriding ${key} with: ${newValue}`);
configObj[key] = newValue;
if (!_.isEmpty(configJSON)) {
logger.info(
`Extending ${configName} `
+ `with: ${JSON.stringify(configJSON)}`);
_.merge(configObj, configJSON);
}
}
}
@ -227,20 +222,21 @@ export function setConfigFromURLParams() {
loggingConfig && (json.loggingConfig = {});
for (const param of Object.keys(params)) {
const objEnd = param.indexOf('.');
let base = json;
const names = param.split('.');
const last = names.pop();
if (objEnd !== -1) {
const obj = param.substring(0, objEnd);
if (json.hasOwnProperty(obj)) {
const key = param.substring(objEnd + 1);
// Prevent passing some parameters which can inject scripts.
if (key && _KEYS_TO_IGNORE.indexOf(key) === -1) {
json[obj][key] = params[param];
}
}
// Prevent passing some parameters which can inject scripts.
if (_KEYS_TO_IGNORE.indexOf(last) !== -1) {
// eslint-disable-next-line no-continue
continue;
}
for (const name of names) {
base = base[name] = base[name] || {};
}
base[last] = params[param];
}
overrideConfigJSON(config, interfaceConfig, loggingConfig, json);