瀏覽代碼

Merge pull request #1402 from jitsi/p2p_ver2

P2P ver2
j8
bbaldino 8 年之前
父節點
當前提交
9a46896600
共有 5 個檔案被更改,包括 64 行新增4 行删除
  1. 33
    0
      conference.js
  2. 17
    1
      config.js
  3. 2
    1
      lang/main.json
  4. 10
    2
      modules/UI/videolayout/ConnectionIndicator.js
  5. 2
    0
      modules/UI/videolayout/VideoLayout.js

+ 33
- 0
conference.js 查看文件

@@ -741,6 +741,39 @@ export default {
741 741
         return this._room
742 742
             && this._room.getConnectionState();
743 743
     },
744
+    /**
745
+     * Obtains current P2P ICE connection state.
746
+     * @return {string|null} ICE connection state or <tt>null</tt> if there's no
747
+     * P2P connection
748
+     */
749
+    getP2PConnectionState () {
750
+        return this._room
751
+            && this._room.getP2PConnectionState();
752
+    },
753
+    /**
754
+     * Starts P2P (for tests only)
755
+     * @private
756
+     */
757
+    _startP2P () {
758
+        try {
759
+            this._room && this._room.startP2PSession();
760
+        } catch (error) {
761
+            logger.error("Start P2P failed", error);
762
+            throw error;
763
+        }
764
+    },
765
+    /**
766
+     * Stops P2P (for tests only)
767
+     * @private
768
+     */
769
+    _stopP2P () {
770
+        try {
771
+            this._room && this._room.stopP2PSession();
772
+        } catch (error) {
773
+            logger.error("Stop P2P failed", error);
774
+            throw error;
775
+        }
776
+    },
744 777
     /**
745 778
      * Checks whether or not our connection is currently in interrupted and
746 779
      * reconnect attempts are in progress.

+ 17
- 1
config.js 查看文件

@@ -20,6 +20,13 @@ var config = { // eslint-disable-line no-unused-vars
20 20
     //focusUserJid: 'focus@auth.jitsi-meet.example.com', // The real JID of focus participant - can be overridden here
21 21
     //defaultSipNumber: '', // Default SIP number
22 22
 
23
+    // The STUN servers that will be used in the peer to peer connections
24
+    p2pStunServers: [
25
+        { urls: "stun:stun.l.google.com:19302" },
26
+        { urls: "stun:stun1.l.google.com:19302" },
27
+        { urls: "stun:stun2.l.google.com:19302" }
28
+    ],
29
+
23 30
     // The ID of the jidesha extension for Chrome.
24 31
     desktopSharingChromeExtId: null,
25 32
     // Whether desktop sharing should be disabled on Chrome.
@@ -80,5 +87,14 @@ var config = { // eslint-disable-line no-unused-vars
80 87
     // disables or enables RTX (RFC 4588) (defaults to false).
81 88
     disableRtx: false,
82 89
     // Sets the preferred resolution (height) for local video. Defaults to 360.
83
-    resolution: 720
90
+    resolution: 720,
91
+    // Enables peer to peer mode. When enabled system will try to establish
92
+    // direct connection given that there are exactly 2 participants in
93
+    // the room. If that succeeds the conference will stop sending data through
94
+    // the JVB and use the peer to peer connection instead. When 3rd participant
95
+    // joins the conference will be moved back to the JVB connection.
96
+    //enableP2P: true
97
+    // How long we're going to wait, before going back to P2P after
98
+    // the 3rd participant has left the conference (to filter out page reload)
99
+    //backToP2PDelay: 5
84 100
 };

+ 2
- 1
lang/main.json 查看文件

@@ -193,7 +193,8 @@
193 193
         "transport": "Transport:",
194 194
         "transport_plural": "Transports:",
195 195
         "bandwidth": "Estimated bandwidth:",
196
-        "na": "Come back here for connection information once the conference starts"
196
+        "na": "Come back here for connection information once the conference starts",
197
+        "direct": " (direct)"
197 198
     },
198 199
     "notify": {
199 200
         "disconnected": "disconnected",

+ 10
- 2
modules/UI/videolayout/ConnectionIndicator.js 查看文件

@@ -198,6 +198,9 @@ ConnectionIndicator.prototype.generateText = function () {
198 198
                 }
199 199
             }
200 200
 
201
+            // All of the transports should be either P2P or JVB
202
+            const isP2P = this.transport.length ? this.transport[0].p2p : false;
203
+
201 204
             var local_address_key = "connectionindicator.localaddress";
202 205
             var remote_address_key = "connectionindicator.remoteaddress";
203 206
             var localTransport =
@@ -243,8 +246,13 @@ ConnectionIndicator.prototype.generateText = function () {
243 246
                     JSON.stringify({count: data.transportType.length})
244 247
                 + "'></span></td>" +
245 248
                 "<td>"
246
-                    + ConnectionIndicator.getStringFromArray(data.transportType)
247
-                + "</td></tr>";
249
+                    + ConnectionIndicator.getStringFromArray(data.transportType);
250
+            // Append (direct) to indicate the P2P type of transport
251
+            if (isP2P) {
252
+                transport += "<span data-i18n='connectionindicator.direct'>";
253
+            }
254
+            // Close "type" column and end table row
255
+            transport += "</td></tr>";
248 256
 
249 257
         }
250 258
 

+ 2
- 0
modules/UI/videolayout/VideoLayout.js 查看文件

@@ -718,6 +718,8 @@ var VideoLayout = {
718 718
     updateLocalConnectionStats (percent, object) {
719 719
         const { framerate, resolution } = object;
720 720
 
721
+        // FIXME overwrites 'lib-jitsi-meet' internal object
722
+        // Why library internal objects are passed as event's args ?
721 723
         object.resolution = resolution[APP.conference.getMyUserId()];
722 724
         object.framerate = framerate[APP.conference.getMyUserId()];
723 725
         localVideoThumbnail.updateStatsIndicator(percent, object);

Loading…
取消
儲存