Sfoglia il codice sorgente

ref: open WebRTC DataChannel

Changes the behavior to actively open new WebRTC Data Channel instead
of waiting for the JVB to do it.

Adds ICE_RESTART_SUCCESS event used to re-initialize the data channel in
case of ICE restart where the conference could have been moved to
another bridge.
dev1
paweldomas 6 anni fa
parent
commit
bbfe2eaea0

+ 11
- 0
JitsiConferenceEventManager.js Vedi File

@@ -74,6 +74,17 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function() {
74 74
         // else: there are no DataChannels in P2P session (at least for now)
75 75
     });
76 76
 
77
+    chatRoom.addListener(
78
+        XMPPEvents.ICE_RESTART_SUCCESS,
79
+        (jingleSession, offerIq) => {
80
+            // The JVB data chanel needs to be reopened in case the conference
81
+            // has been moved to a new bridge.
82
+            !jingleSession.isP2P
83
+                && conference._setBridgeChannel(
84
+                    offerIq, jingleSession.peerconnection);
85
+        });
86
+
87
+
77 88
     chatRoom.addListener(XMPPEvents.AUDIO_MUTED_BY_FOCUS,
78 89
         () => {
79 90
             // TODO: Add a way to differentiate between commands which caused

+ 9
- 10
modules/RTC/BridgeChannel.js Vedi File

@@ -49,16 +49,15 @@ export default class BridgeChannel {
49 49
         // If a RTCPeerConnection is given, listen for new RTCDataChannel
50 50
         // event.
51 51
         if (peerconnection) {
52
-            peerconnection.ondatachannel = event => {
53
-                // NOTE: We assume that the "onDataChannel" event just fires
54
-                // once.
55
-
56
-                const datachannel = event.channel;
57
-
58
-                // Handle the RTCDataChannel.
59
-                this._handleChannel(datachannel);
60
-                this._mode = 'datachannel';
61
-            };
52
+            const datachannel
53
+                = peerconnection.createDataChannel(
54
+                    'JVB data channel', {
55
+                        protocol: 'http://jitsi.org/protocols/colibri'
56
+                    });
57
+
58
+            // Handle the RTCDataChannel.
59
+            this._handleChannel(datachannel);
60
+            this._mode = 'datachannel';
62 61
 
63 62
         // Otherwise create a WebSocket connection.
64 63
         } else if (wsUrl) {

+ 5
- 0
modules/xmpp/JingleSessionPC.js Vedi File

@@ -1000,6 +1000,11 @@ export default class JingleSessionPC extends JingleSession {
1000 1000
                             = new SDP(this.peerconnection.localDescription.sdp);
1001 1001
 
1002 1002
                         this.sendTransportAccept(localSDP, success, failure);
1003
+
1004
+                        this.room.eventEmitter.emit(
1005
+                            XMPPEvents.ICE_RESTART_SUCCESS,
1006
+                            this,
1007
+                            originalOffer);
1003 1008
                     },
1004 1009
                     failure);
1005 1010
             },

+ 6
- 0
service/xmpp/XMPPEvents.js Vedi File

@@ -76,6 +76,12 @@ const XMPPEvents = {
76 76
      */
77 77
     ICE_RESTARTING: 'rtc.ice_restarting',
78 78
 
79
+    /**
80
+     * Event fired after the 'transport-replace' message has been processed
81
+     * and the new offer has been set successfully.
82
+     */
83
+    ICE_RESTART_SUCCESS: 'rtc.ice_restart_success',
84
+
79 85
     /* Event fired when XMPP error is returned to any request, it is meant to be
80 86
      * used to report 'signaling' errors to CallStats
81 87
      *

Loading…
Annulla
Salva