Преглед изворни кода

Workaround for Chrome ice connection failure detection (#1685)

* fix: re-enable that ICE connection failures in Chrome are detected
* fixed linting errors
tags/v0.0.2
Nils Ohlmeier пре 4 година
родитељ
комит
d4bb376f96
No account linked to committer's email address
2 измењених фајлова са 32 додато и 0 уклоњено
  1. 10
    0
      modules/RTC/TraceablePeerConnection.js
  2. 22
    0
      modules/xmpp/JingleSessionPC.js

+ 10
- 0
modules/RTC/TraceablePeerConnection.js Прегледај датотеку

355
             this.onnegotiationneeded(event);
355
             this.onnegotiationneeded(event);
356
         }
356
         }
357
     };
357
     };
358
+    this.onconnectionstatechange = null;
359
+    this.peerconnection.onconnectionstatechange = event => {
360
+        this.trace('onconnectionstatechange', this.connectionState);
361
+        if (this.onconnectionstatechange !== null) {
362
+            this.onconnectionstatechange(event);
363
+        }
364
+    };
358
     this.ondatachannel = null;
365
     this.ondatachannel = null;
359
     this.peerconnection.ondatachannel = event => {
366
     this.peerconnection.ondatachannel = event => {
360
         this.trace('ondatachannel');
367
         this.trace('ondatachannel');
1496
     iceConnectionState() {
1503
     iceConnectionState() {
1497
         return this.peerconnection.iceConnectionState;
1504
         return this.peerconnection.iceConnectionState;
1498
     },
1505
     },
1506
+    connectionState() {
1507
+        return this.peerconnection.connectionState;
1508
+    },
1499
     localDescription() {
1509
     localDescription() {
1500
         let desc = this.peerconnection.localDescription;
1510
         let desc = this.peerconnection.localDescription;
1501
 
1511
 

+ 22
- 0
modules/xmpp/JingleSessionPC.js Прегледај датотеку

559
             }
559
             }
560
         };
560
         };
561
 
561
 
562
+
563
+        /**
564
+         * The connection state event is fired whenever the aggregate of underlying
565
+         * transports change their state.
566
+         */
567
+        this.peerconnection.onconnectionstatechange = () => {
568
+            const icestate = this.peerconnection.iceConnectionState;
569
+
570
+            switch (this.peerconnection.connectionState) {
571
+            case 'failed':
572
+                // Since version 76 Chrome no longer switches ICE connection
573
+                // state to failed (see
574
+                // https://bugs.chromium.org/p/chromium/issues/detail?id=982793
575
+                // for details) we use this workaround to recover from lost connections
576
+                if (icestate === 'disconnected') {
577
+                    this.room.eventEmitter.emit(
578
+                        XMPPEvents.CONNECTION_ICE_FAILED, this);
579
+                }
580
+                break;
581
+            }
582
+        };
583
+
562
         /**
584
         /**
563
          * The negotiationneeded event is fired whenever we shake the media on the
585
          * The negotiationneeded event is fired whenever we shake the media on the
564
          * RTCPeerConnection object.
586
          * RTCPeerConnection object.

Loading…
Откажи
Сачувај