Explorar el Código

Merge branch 'master' into talk-muted

dev1
Lyubomir Marinov hace 9 años
padre
commit
49c4a56ae0
Se han modificado 2 ficheros con 43 adiciones y 13 borrados
  1. 3
    1
      JitsiConference.js
  2. 40
    12
      modules/connectivity/ParticipantConnectionStatus.js

+ 3
- 1
JitsiConference.js Ver fichero

96
     }
96
     }
97
 
97
 
98
     this.participantConnectionStatus
98
     this.participantConnectionStatus
99
-        = new ParticipantConnectionStatus(this.rtc, this);
99
+        = new ParticipantConnectionStatus(
100
+                this.rtc, this,
101
+                options.config.peerDisconnectedThroughRtcTimeout);
100
     this.participantConnectionStatus.init();
102
     this.participantConnectionStatus.init();
101
 
103
 
102
     if(!this.statistics) {
104
     if(!this.statistics) {

+ 40
- 12
modules/connectivity/ParticipantConnectionStatus.js Ver fichero

6
 
6
 
7
 import * as JitsiConferenceEvents from '../../JitsiConferenceEvents';
7
 import * as JitsiConferenceEvents from '../../JitsiConferenceEvents';
8
 import * as JitsiTrackEvents from '../../JitsiTrackEvents';
8
 import * as JitsiTrackEvents from '../../JitsiTrackEvents';
9
+import Statistics from '../statistics/statistics';
9
 
10
 
10
 /**
11
 /**
11
- * How long we're going to wait after the RTC video track muted event for
12
- * the corresponding signalling mute event, before the connection interrupted
13
- * is fired.
12
+ * Default value of 2000 milliseconds for
13
+ * {@link ParticipantConnectionStatus.rtcMuteTimeout}.
14
  *
14
  *
15
- * @type {number} amount of time in milliseconds
15
+ * @type {number}
16
  */
16
  */
17
-const RTC_MUTE_TIMEOUT = 1000;
17
+const DEFAULT_RTC_MUTE_TIMEOUT = 2000;
18
 
18
 
19
 /**
19
 /**
20
  * Class is responsible for emitting
20
  * Class is responsible for emitting
21
  * JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED events.
21
  * JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED events.
22
  *
22
  *
23
  * @constructor
23
  * @constructor
24
- * @param rtc {RTC} the RTC service instance
25
- * @param conference {JitsiConference} parent conference instance
24
+ * @param {RTC} rtc the RTC service instance
25
+ * @param {JitsiConference} conference parent conference instance
26
+ * @param {number} rtcMuteTimeout (optional) custom value for
27
+ * {@link ParticipantConnectionStatus.rtcMuteTimeout}.
26
  */
28
  */
27
-function ParticipantConnectionStatus(rtc, conference) {
29
+function ParticipantConnectionStatus(rtc, conference, rtcMuteTimeout) {
28
     this.rtc = rtc;
30
     this.rtc = rtc;
29
     this.conference = conference;
31
     this.conference = conference;
30
     /**
32
     /**
34
      * @type {Object.<string, number>}
36
      * @type {Object.<string, number>}
35
      */
37
      */
36
     this.trackTimers = {};
38
     this.trackTimers = {};
39
+    /**
40
+     * How long we're going to wait after the RTC video track muted event for
41
+     * the corresponding signalling mute event, before the connection
42
+     * interrupted is fired. The default value is
43
+     * {@link DEFAULT_RTC_MUTE_TIMEOUT}.
44
+     *
45
+     * @type {number} amount of time in milliseconds
46
+     */
47
+    this.rtcMuteTimeout
48
+        = typeof rtcMuteTimeout === 'number'
49
+            ? rtcMuteTimeout : DEFAULT_RTC_MUTE_TIMEOUT;
50
+    logger.info("RtcMuteTimeout set to: " + this.rtcMuteTimeout);
37
 }
51
 }
38
 
52
 
39
 /**
53
 /**
165
         return;
179
         return;
166
     }
180
     }
167
     if (participant.isConnectionActive() !== newStatus) {
181
     if (participant.isConnectionActive() !== newStatus) {
182
+
168
         participant._setIsConnectionActive(newStatus);
183
         participant._setIsConnectionActive(newStatus);
184
+
169
         logger.debug(
185
         logger.debug(
170
             'Emit endpoint conn status(' + Date.now() + '): ',
186
             'Emit endpoint conn status(' + Date.now() + '): ',
171
             endpointId, newStatus);
187
             endpointId, newStatus);
188
+
189
+        // Log the event on CallStats
190
+        Statistics.sendLog(
191
+            JSON.stringify({
192
+                id: 'peer.conn.status',
193
+                participant: endpointId,
194
+                status: newStatus
195
+            }));
196
+
197
+        // and analytics
198
+        Statistics.analytics.sendEvent('peer.conn.status', null, newStatus);
199
+
172
         this.conference.eventEmitter.emit(
200
         this.conference.eventEmitter.emit(
173
             JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED,
201
             JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED,
174
             endpointId, newStatus);
202
             endpointId, newStatus);
232
 /**
260
 /**
233
  * Handles RTC 'onmute' event for the video track.
261
  * Handles RTC 'onmute' event for the video track.
234
  *
262
  *
235
- * @param track {JitsiRemoteTrack} the video track for which 'onmute' event will
263
+ * @param {JitsiRemoteTrack} track the video track for which 'onmute' event will
236
  * be processed.
264
  * be processed.
237
  */
265
  */
238
 ParticipantConnectionStatus.prototype.onTrackRtcMuted = function(track) {
266
 ParticipantConnectionStatus.prototype.onTrackRtcMuted = function(track) {
254
                 this._changeConnectionStatus(participantId, false);
282
                 this._changeConnectionStatus(participantId, false);
255
             }
283
             }
256
             this.clearTimeout(participantId);
284
             this.clearTimeout(participantId);
257
-        }.bind(this), RTC_MUTE_TIMEOUT);
285
+        }.bind(this), this.rtcMuteTimeout);
258
     }
286
     }
259
 };
287
 };
260
 
288
 
261
 /**
289
 /**
262
  * Handles RTC 'onunmute' event for the video track.
290
  * Handles RTC 'onunmute' event for the video track.
263
  *
291
  *
264
- * @param track {JitsiRemoteTrack} the video track for which 'onunmute' event
292
+ * @param {JitsiRemoteTrack} track the video track for which 'onunmute' event
265
  * will be processed.
293
  * will be processed.
266
  */
294
  */
267
 ParticipantConnectionStatus.prototype.onTrackRtcUnmuted = function(track) {
295
 ParticipantConnectionStatus.prototype.onTrackRtcUnmuted = function(track) {
281
 /**
309
 /**
282
  * Here the signalling "mute"/"unmute" events are processed.
310
  * Here the signalling "mute"/"unmute" events are processed.
283
  *
311
  *
284
- * @param track {JitsiRemoteTrack} the remote video track for which
312
+ * @param {JitsiRemoteTrack} track the remote video track for which
285
  * the signalling mute/unmute event will be processed.
313
  * the signalling mute/unmute event will be processed.
286
  */
314
  */
287
 ParticipantConnectionStatus.prototype.onSignallingMuteChanged
315
 ParticipantConnectionStatus.prototype.onSignallingMuteChanged

Loading…
Cancelar
Guardar