Browse Source

fix(JingleSessionPC): Add a workaround for chrome issue.

The 'signalingstatechange' event for 'stable' is fired after the 'iceconnectionstatechange' event for 'completed' is fired on chrome in Unified plan. This prevents the client from switching the media connection to the p2p connection once the ice connection for p2p gets established.
dev1
Jaya Allamsetty 4 years ago
parent
commit
6f81b69745
1 changed files with 13 additions and 1 deletions
  1. 13
    1
      modules/xmpp/JingleSessionPC.js

+ 13
- 1
modules/xmpp/JingleSessionPC.js View File

449
          */
449
          */
450
         this.peerconnection.oniceconnectionstatechange = () => {
450
         this.peerconnection.oniceconnectionstatechange = () => {
451
             const now = window.performance.now();
451
             const now = window.performance.now();
452
+            let isStable = false;
452
 
453
 
453
             if (!this.isP2P) {
454
             if (!this.isP2P) {
454
                 this.room.connectionTimes[
455
                 this.room.connectionTimes[
479
                 // Informs interested parties that the connection has been restored. This includes the case when
480
                 // Informs interested parties that the connection has been restored. This includes the case when
480
                 // media connection to the bridge has been restored after an ICE failure by using session-terminate.
481
                 // media connection to the bridge has been restored after an ICE failure by using session-terminate.
481
                 if (this.peerconnection.signalingState === 'stable') {
482
                 if (this.peerconnection.signalingState === 'stable') {
483
+                    isStable = true;
482
                     const usesTerminateForRestart = !this.options.enableIceRestart
484
                     const usesTerminateForRestart = !this.options.enableIceRestart
483
                         && this.room.supportsRestartByTerminate();
485
                         && this.room.supportsRestartByTerminate();
484
 
486
 
488
                     }
490
                     }
489
                 }
491
                 }
490
 
492
 
491
-                if (!this.wasConnected && this.wasstable) {
493
+                // Add a workaround for an issue on chrome in Unified plan when the local endpoint is the offerer.
494
+                // The 'signalingstatechange' event for 'stable' is handled after the 'iceconnectionstatechange' event
495
+                // for 'completed' is handled by the client. This prevents the client from firing a
496
+                // CONNECTION_ESTABLISHED event for the p2p session. As a result, the offerer continues to stay on the
497
+                // jvb connection while the remote peer switches to the p2p connection breaking the media flow between
498
+                // the endpoints.
499
+                // TODO - file a chromium bug and add the information here.
500
+                if (!this.wasConnected
501
+                    && (this.wasstable
502
+                        || isStable
503
+                        || (this.usesUnifiedPlan && this.isInitiator && browser.isChromiumBased()))) {
492
 
504
 
493
                     Statistics.sendAnalytics(
505
                     Statistics.sendAnalytics(
494
                         ICE_DURATION,
506
                         ICE_DURATION,

Loading…
Cancel
Save