浏览代码

CONNECTION_INTERRUPTED event will now be generated if we've ever been in stable state(we can go into "unstable" state after muting video and connection problems screen will not be displayed).

master
paweldomas 9 年前
父节点
当前提交
f559bd1ba4
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9
    1
      modules/xmpp/JingleSessionPC.js

+ 9
- 1
modules/xmpp/JingleSessionPC.js 查看文件

83
     this.hadstuncandidate = false;
83
     this.hadstuncandidate = false;
84
     this.hadturncandidate = false;
84
     this.hadturncandidate = false;
85
     this.lasticecandidate = false;
85
     this.lasticecandidate = false;
86
+    // True if reconnect is in progress
86
     this.isreconnect = false;
87
     this.isreconnect = false;
88
+    // Set to true if the connection was ever stable
89
+    this.wasstable = false;
87
 
90
 
88
     this.peerconnection = new TraceablePeerConnection(
91
     this.peerconnection = new TraceablePeerConnection(
89
             this.connection.jingle.ice_config,
92
             this.connection.jingle.ice_config,
112
     };
115
     };
113
     this.peerconnection.onsignalingstatechange = function (event) {
116
     this.peerconnection.onsignalingstatechange = function (event) {
114
         if (!(self && self.peerconnection)) return;
117
         if (!(self && self.peerconnection)) return;
118
+        console.info("Signaling: " + this.peerconnection.signalingState);
119
+        if (self.peerconnection.signalingState === 'stable') {
120
+            self.wasstable = true;
121
+        }
115
         self.updateModifySourcesQueue();
122
         self.updateModifySourcesQueue();
116
     };
123
     };
117
     /**
124
     /**
123
      */
130
      */
124
     this.peerconnection.oniceconnectionstatechange = function (event) {
131
     this.peerconnection.oniceconnectionstatechange = function (event) {
125
         if (!(self && self.peerconnection)) return;
132
         if (!(self && self.peerconnection)) return;
133
+        console.info("Ice: " + self.peerconnection.iceConnectionState);
126
         self.updateModifySourcesQueue();
134
         self.updateModifySourcesQueue();
127
         switch (self.peerconnection.iceConnectionState) {
135
         switch (self.peerconnection.iceConnectionState) {
128
             case 'connected':
136
             case 'connected':
136
             case 'disconnected':
144
             case 'disconnected':
137
                 self.isreconnect = true;
145
                 self.isreconnect = true;
138
                 // Informs interested parties that the connection has been interrupted.
146
                 // Informs interested parties that the connection has been interrupted.
139
-                if (self.peerconnection.signalingState === 'stable')
147
+                if (self.wasstable)
140
                     self.eventEmitter.emit(XMPPEvents.CONNECTION_INTERRUPTED);
148
                     self.eventEmitter.emit(XMPPEvents.CONNECTION_INTERRUPTED);
141
                 break;
149
                 break;
142
             case 'failed':
150
             case 'failed':

正在加载...
取消
保存