Selaa lähdekoodia

feat(ParticipantConnectionStatus): add RTC mute timeout config

The timeout will be configurable though
'peerDisconnectedThroughRtcTimeout' conference config option. It has
not been document in the public API on purpose.
dev1
paweldomas 9 vuotta sitten
vanhempi
commit
eb204558b2
2 muutettua tiedostoa jossa 23 lisäystä ja 8 poistoa
  1. 3
    1
      JitsiConference.js
  2. 20
    7
      modules/connectivity/ParticipantConnectionStatus.js

+ 3
- 1
JitsiConference.js Näytä tiedosto

@@ -95,7 +95,9 @@ JitsiConference.prototype._init = function (options) {
95 95
     }
96 96
 
97 97
     this.participantConnectionStatus
98
-        = new ParticipantConnectionStatus(this.rtc, this);
98
+        = new ParticipantConnectionStatus(
99
+                this.rtc, this,
100
+                options.config.peerDisconnectedThroughRtcTimeout);
99 101
     this.participantConnectionStatus.init();
100 102
 
101 103
     if(!this.statistics) {

+ 20
- 7
modules/connectivity/ParticipantConnectionStatus.js Näytä tiedosto

@@ -8,13 +8,12 @@ import * as JitsiConferenceEvents from '../../JitsiConferenceEvents';
8 8
 import * as JitsiTrackEvents from '../../JitsiTrackEvents';
9 9
 
10 10
 /**
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.
11
+ * Default value of 1000 milliseconds for
12
+ * {@link ParticipantConnectionStatus.rtcMuteTimeout}.
14 13
  *
15
- * @type {number} amount of time in milliseconds
14
+ * @type {number}
16 15
  */
17
-const RTC_MUTE_TIMEOUT = 1000;
16
+const DEFAULT_RTC_MUTE_TIMEOUT = 1000;
18 17
 
19 18
 /**
20 19
  * Class is responsible for emitting
@@ -23,8 +22,10 @@ const RTC_MUTE_TIMEOUT = 1000;
23 22
  * @constructor
24 23
  * @param {RTC} rtc the RTC service instance
25 24
  * @param {JitsiConference} conference parent conference instance
25
+ * @param {number} rtcMuteTimeout (optional) custom value for
26
+ * {@link ParticipantConnectionStatus.rtcMuteTimeout}.
26 27
  */
27
-function ParticipantConnectionStatus(rtc, conference) {
28
+function ParticipantConnectionStatus(rtc, conference, rtcMuteTimeout) {
28 29
     this.rtc = rtc;
29 30
     this.conference = conference;
30 31
     /**
@@ -34,6 +35,18 @@ function ParticipantConnectionStatus(rtc, conference) {
34 35
      * @type {Object.<string, number>}
35 36
      */
36 37
     this.trackTimers = {};
38
+    /**
39
+     * How long we're going to wait after the RTC video track muted event for
40
+     * the corresponding signalling mute event, before the connection
41
+     * interrupted is fired. The default value is
42
+     * {@link DEFAULT_RTC_MUTE_TIMEOUT}.
43
+     *
44
+     * @type {number} amount of time in milliseconds
45
+     */
46
+    this.rtcMuteTimeout
47
+        = typeof rtcMuteTimeout === 'number'
48
+            ? rtcMuteTimeout : DEFAULT_RTC_MUTE_TIMEOUT;
49
+    logger.info("RtcMuteTimeout set to: " + this.rtcMuteTimeout);
37 50
 }
38 51
 
39 52
 /**
@@ -254,7 +267,7 @@ ParticipantConnectionStatus.prototype.onTrackRtcMuted = function(track) {
254 267
                 this._changeConnectionStatus(participantId, false);
255 268
             }
256 269
             this.clearTimeout(participantId);
257
-        }.bind(this), RTC_MUTE_TIMEOUT);
270
+        }.bind(this), this.rtcMuteTimeout);
258 271
     }
259 272
 };
260 273
 

Loading…
Peruuta
Tallenna