From fb47b6ae21666cf7ecdeb3e01b891d3e37baa3f0 Mon Sep 17 00:00:00 2001 From: paweldomas Date: Wed, 15 Feb 2017 15:19:52 -0600 Subject: [PATCH 1/4] feat: add test P2P methods --- conference.js | 33 +++++++++++++++++++++++++++++++++ config.js | 11 ++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/conference.js b/conference.js index 94d3cef15..4355544f5 100644 --- a/conference.js +++ b/conference.js @@ -729,6 +729,39 @@ export default { return this._room && this._room.getConnectionState(); }, + /** + * Obtains current P2P ICE connection state. + * @return {string|null} ICE connection state or null if there's no + * P2P connection + */ + getP2PConnectionState () { + return this._room + && this._room.getP2PConnectionState(); + }, + /** + * Starts P2P (for tests only) + * @private + */ + _startP2P () { + try { + this._room && this._room.startP2PSession(); + } catch (error) { + logger.error("Start P2P failed", error); + throw error; + } + }, + /** + * Stops P2P (for tests only) + * @private + */ + _stopP2P () { + try { + this._room && this._room.stopP2PSession(); + } catch (error) { + logger.error("Stop P2P failed", error); + throw error; + } + }, /** * Checks whether or not our connection is currently in interrupted and * reconnect attempts are in progress. diff --git a/config.js b/config.js index 9549698fe..b64d8351e 100644 --- a/config.js +++ b/config.js @@ -80,5 +80,14 @@ var config = { // eslint-disable-line no-unused-vars // disables or enables RTX (RFC 4588) (defaults to false). disableRtx: false, // Sets the preferred resolution (height) for local video. Defaults to 360. - resolution: 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 }; From 542bb7caed10256aa5a581de47f76e74467aa5bd Mon Sep 17 00:00:00 2001 From: paweldomas Date: Mon, 20 Feb 2017 14:03:04 -0600 Subject: [PATCH 2/4] doc: add FIXME --- modules/UI/videolayout/VideoLayout.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index b058218cc..cfc616bfb 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -859,6 +859,8 @@ var VideoLayout = { updateLocalConnectionStats (percent, object) { const { framerate, resolution } = object; + // FIXME overwrites 'lib-jitsi-meet' internal object + // Why library internal objects are passed as event's args ? object.resolution = resolution[APP.conference.getMyUserId()]; object.framerate = framerate[APP.conference.getMyUserId()]; localVideoThumbnail.updateStatsIndicator(percent, object); From 2973364c0257c416d042cde6bb629eee958b7900 Mon Sep 17 00:00:00 2001 From: paweldomas Date: Mon, 20 Feb 2017 12:06:35 -0600 Subject: [PATCH 3/4] feat(stats - show more): local p2p transport indication Will show (direct) next to the UPD or TCP transport type if we're running on P2P connection. --- lang/main.json | 3 ++- modules/UI/videolayout/ConnectionIndicator.js | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lang/main.json b/lang/main.json index fd9978a7c..357b93ed9 100644 --- a/lang/main.json +++ b/lang/main.json @@ -192,7 +192,8 @@ "transport": "Transport:", "transport_plural": "Transports:", "bandwidth": "Estimated bandwidth:", - "na": "Come back here for connection information once the conference starts" + "na": "Come back here for connection information once the conference starts", + "direct": " (direct)" }, "notify": { "disconnected": "disconnected", diff --git a/modules/UI/videolayout/ConnectionIndicator.js b/modules/UI/videolayout/ConnectionIndicator.js index 70b2a990e..802e1ae6c 100644 --- a/modules/UI/videolayout/ConnectionIndicator.js +++ b/modules/UI/videolayout/ConnectionIndicator.js @@ -198,6 +198,9 @@ ConnectionIndicator.prototype.generateText = function () { } } + // All of the transports should be either P2P or JVB + const isP2P = this.transport.length ? this.transport[0].p2p : false; + var local_address_key = "connectionindicator.localaddress"; var remote_address_key = "connectionindicator.remoteaddress"; var localTransport = @@ -243,8 +246,13 @@ ConnectionIndicator.prototype.generateText = function () { JSON.stringify({count: data.transportType.length}) + "'>" + "" - + ConnectionIndicator.getStringFromArray(data.transportType) - + ""; + + ConnectionIndicator.getStringFromArray(data.transportType); + // Append (direct) to indicate the P2P type of transport + if (isP2P) { + transport += ""; + } + // Close "type" column and end table row + transport += ""; } From fba086134dff55fb58aaf45515de7cae993b3deb Mon Sep 17 00:00:00 2001 From: paweldomas Date: Wed, 22 Feb 2017 14:37:03 -0600 Subject: [PATCH 4/4] add default STUN servers to config.js --- config.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config.js b/config.js index b64d8351e..7e5d47fe7 100644 --- a/config.js +++ b/config.js @@ -20,6 +20,13 @@ 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.