Procházet zdrojové kódy

Merge pull request #563 from jitsi/fix_no_datachannel

fix: never miss 'ondatachannel' event
dev1
Saúl Ibarra Corretgé před 8 roky
rodič
revize
8d7510500a
2 změnil soubory, kde provedl 22 přidání a 31 odebrání
  1. 22
    8
      JitsiConference.js
  2. 0
    23
      modules/xmpp/JingleSessionPC.js

+ 22
- 8
JitsiConference.js Zobrazit soubor

@@ -1,4 +1,4 @@
1
-/* global __filename, Strophe, Promise */
1
+/* global __filename, $, Strophe, Promise */
2 2
 
3 3
 import AvgRTPStatsReporter from './modules/statistics/AvgRTPStatsReporter';
4 4
 import ComponentsVersions from './modules/version/ComponentsVersions';
@@ -1390,6 +1390,9 @@ JitsiConference.prototype.onIncomingCall
1390 1390
         GlobalOnErrorHandler.callErrorHandler(error);
1391 1391
     }
1392 1392
 
1393
+    // Open a channel with the videobridge.
1394
+    this._setBridgeChannel(jingleOffer, jingleSession.peerconnection);
1395
+
1393 1396
     // Add local tracks to the session
1394 1397
     try {
1395 1398
         jingleSession.acceptOffer(
@@ -1401,9 +1404,6 @@ JitsiConference.prototype.onIncomingCall
1401 1404
                 if (this.isP2PActive() && this.jvbJingleSession) {
1402 1405
                     this._suspendMediaTransferForJvbConnection();
1403 1406
                 }
1404
-
1405
-                // Open a channel with the videobridge.
1406
-                this._setBridgeChannel();
1407 1407
             },
1408 1408
             error => {
1409 1409
                 GlobalOnErrorHandler.callErrorHandler(error);
@@ -1430,10 +1430,24 @@ JitsiConference.prototype.onIncomingCall
1430 1430
 
1431 1431
 /**
1432 1432
  * Sets the BridgeChannel.
1433
+ *
1434
+ * @param {jQuery} offerIq a jQuery selector pointing to the jingle element of
1435
+ * the offer IQ which may carry the WebSocket URL for the 'websocket'
1436
+ * BridgeChannel mode.
1437
+ * @param {TraceablePeerConnection} pc the peer connection which will be used
1438
+ * to listen for new WebRTC Data Channels (in the 'datachannel' mode).
1433 1439
  */
1434
-JitsiConference.prototype._setBridgeChannel = function() {
1435
-    const jingleSession = this.jvbJingleSession;
1436
-    const wsUrl = jingleSession.bridgeWebSocketUrl;
1440
+JitsiConference.prototype._setBridgeChannel = function(offerIq, pc) {
1441
+    let wsUrl = null;
1442
+    const webSocket
1443
+        = $(offerIq)
1444
+            .find('>content>transport>web-socket')
1445
+            .first();
1446
+
1447
+    if (webSocket.length === 1) {
1448
+        wsUrl = webSocket[0].getAttribute('url');
1449
+    }
1450
+
1437 1451
     let bridgeChannelType;
1438 1452
 
1439 1453
     switch (this.options.config.openBridgeChannel) {
@@ -1453,7 +1467,7 @@ JitsiConference.prototype._setBridgeChannel = function() {
1453 1467
     }
1454 1468
 
1455 1469
     if (bridgeChannelType === 'datachannel') {
1456
-        this.rtc.initializeBridgeChannel(jingleSession.peerconnection, null);
1470
+        this.rtc.initializeBridgeChannel(pc, null);
1457 1471
     } else if (bridgeChannelType === 'websocket' && wsUrl) {
1458 1472
         this.rtc.initializeBridgeChannel(null, wsUrl);
1459 1473
     }

+ 0
- 23
modules/xmpp/JingleSessionPC.js Zobrazit soubor

@@ -150,12 +150,6 @@ export default class JingleSessionPC extends JingleSession {
150 150
          */
151 151
         this._gatheringReported = false;
152 152
 
153
-        /**
154
-         * WebSocket URL for the bridge channel with the videobridge.
155
-         * @type {string}
156
-         */
157
-        this.bridgeWebSocketUrl = null;
158
-
159 153
         this.lasticecandidate = false;
160 154
         this.closed = false;
161 155
 
@@ -678,22 +672,6 @@ export default class JingleSessionPC extends JingleSession {
678 672
         });
679 673
     }
680 674
 
681
-    /**
682
-     * Reads the "url" parameter in the <web-socket> tag of the jingle offer iq
683
-     * and stores it into this.bridgeWebSocketUrl.
684
-     * @param contets
685
-     */
686
-    readBridgeWebSocketUrl(contents) {
687
-        const webSocket
688
-            = $(contents)
689
-                .find('transport>web-socket')
690
-                .first();
691
-
692
-        if (webSocket.length === 1) {
693
-            this.bridgeWebSocketUrl = webSocket[0].getAttribute('url');
694
-        }
695
-    }
696
-
697 675
     /**
698 676
      * Makes the underlying TraceablePeerConnection generate new SSRC for
699 677
      * the recvonly video stream.
@@ -1417,7 +1395,6 @@ export default class JingleSessionPC extends JingleSession {
1417 1395
 
1418 1396
         remoteSdp.fromJingle(offerIq);
1419 1397
         this.readSsrcInfo($(offerIq).find('>content'));
1420
-        this.readBridgeWebSocketUrl($(offerIq).find('>content'));
1421 1398
 
1422 1399
         return remoteSdp;
1423 1400
     }

Načítá se…
Zrušit
Uložit