|
@@ -36,6 +36,31 @@ const IQ_TIMEOUT = 10000;
|
36
|
36
|
*/
|
37
|
37
|
const DEFAULT_MAX_STATS = 300;
|
38
|
38
|
|
|
39
|
+/**
|
|
40
|
+ * @typedef {Object} JingleSessionPCOptions
|
|
41
|
+ * @property {Object} abTesting - A/B testing related options (ask George).
|
|
42
|
+ * @property {boolean} abTesting.enableSuspendVideoTest - enables the suspend
|
|
43
|
+ * video test ?(ask George).
|
|
44
|
+ * @property {boolean} disableH264 - Described in the config.js[1].
|
|
45
|
+ * @property {boolean} disableRtx - Described in the config.js[1].
|
|
46
|
+ * @property {boolean} disableSimulcast - Described in the config.js[1].
|
|
47
|
+ * @property {boolean} enableLayerSuspension - Described in the config.js[1].
|
|
48
|
+ * @property {boolean} failICE - it's an option used in the tests. Set to
|
|
49
|
+ * <tt>true</tt> to block any real candidates and make the ICE fail.
|
|
50
|
+ * @property {boolean} gatherStats - Described in the config.js[1].
|
|
51
|
+ * @property {object} p2p - Peer to peer related options (FIXME those could be
|
|
52
|
+ * fetched from config.p2p on the upper level).
|
|
53
|
+ * @property {boolean} p2p.disableH264 - Described in the config.js[1].
|
|
54
|
+ * @property {boolean} p2p.preferH264 - Described in the config.js[1].
|
|
55
|
+ * @property {boolean} preferH264 - Described in the config.js[1].
|
|
56
|
+ * @property {Object} testing - Testing and/or experimental options.
|
|
57
|
+ * @property {boolean} testing.enableFirefoxSimulcast - Described in the
|
|
58
|
+ * config.js[1].
|
|
59
|
+ * @property {boolean} webrtcIceUdpDisable - Described in the config.js[1].
|
|
60
|
+ * @property {boolean} webrtcIceTcpDisable - Described in the config.js[1].
|
|
61
|
+ *
|
|
62
|
+ * [1]: https://github.com/jitsi/jitsi-meet/blob/master/config.js
|
|
63
|
+ */
|
39
|
64
|
/**
|
40
|
65
|
*
|
41
|
66
|
*/
|
|
@@ -82,16 +107,8 @@ export default class JingleSessionPC extends JingleSession {
|
82
|
107
|
* @param {boolean} isP2P indicates whether this instance is
|
83
|
108
|
* meant to be used in a direct, peer to peer connection or <tt>false</tt>
|
84
|
109
|
* if it's a JVB connection.
|
85
|
|
- * @param {boolean} isInitiator indicates whether or not we are the side
|
86
|
|
- * which sends the 'session-initiate'.
|
87
|
|
- * @param {object} options a set of config options
|
88
|
|
- * @param {boolean} options.webrtcIceUdpDisable <tt>true</tt> to block UDP
|
89
|
|
- * candidates.
|
90
|
|
- * @param {boolean} options.webrtcIceTcpDisable <tt>true</tt> to block TCP
|
91
|
|
- * candidates.
|
92
|
|
- * @param {boolean} options.failICE it's an option used in the tests. Set to
|
93
|
|
- * <tt>true</tt> to block any real candidates and make the ICE fail.
|
94
|
|
- *
|
|
110
|
+ * @param {boolean} isInitiator indicates if it will be the side which
|
|
111
|
+ * initiates the session.
|
95
|
112
|
* @constructor
|
96
|
113
|
*
|
97
|
114
|
* @implements {SignalingLayer}
|
|
@@ -104,10 +121,11 @@ export default class JingleSessionPC extends JingleSession {
|
104
|
121
|
mediaConstraints,
|
105
|
122
|
iceConfig,
|
106
|
123
|
isP2P,
|
107
|
|
- isInitiator,
|
108
|
|
- options) {
|
|
124
|
+ isInitiator) {
|
109
|
125
|
super(
|
110
|
|
- sid, localJid, remoteJid, connection, mediaConstraints, iceConfig);
|
|
126
|
+ sid,
|
|
127
|
+ localJid,
|
|
128
|
+ remoteJid, connection, mediaConstraints, iceConfig, isInitiator);
|
111
|
129
|
|
112
|
130
|
/**
|
113
|
131
|
* Stores result of {@link window.performance.now()} at the time when
|
|
@@ -169,13 +187,6 @@ export default class JingleSessionPC extends JingleSession {
|
169
|
187
|
this.lasticecandidate = false;
|
170
|
188
|
this.closed = false;
|
171
|
189
|
|
172
|
|
- /**
|
173
|
|
- * Indicates whether this instance is an initiator or an answerer of
|
174
|
|
- * the Jingle session.
|
175
|
|
- * @type {boolean}
|
176
|
|
- */
|
177
|
|
- this.isInitiator = isInitiator;
|
178
|
|
-
|
179
|
190
|
/**
|
180
|
191
|
* Indicates whether or not this <tt>JingleSessionPC</tt> is used in
|
181
|
192
|
* a peer to peer type of session.
|
|
@@ -190,16 +201,6 @@ export default class JingleSessionPC extends JingleSession {
|
190
|
201
|
*/
|
191
|
202
|
this.signalingLayer = new SignalingLayerImpl();
|
192
|
203
|
|
193
|
|
- this.webrtcIceUdpDisable = Boolean(options.webrtcIceUdpDisable);
|
194
|
|
- this.webrtcIceTcpDisable = Boolean(options.webrtcIceTcpDisable);
|
195
|
|
-
|
196
|
|
- /**
|
197
|
|
- * Flag used to enforce ICE failure through the URL parameter for
|
198
|
|
- * the automatic testing purpose.
|
199
|
|
- * @type {boolean}
|
200
|
|
- */
|
201
|
|
- this.failICE = Boolean(options.failICE);
|
202
|
|
-
|
203
|
204
|
this.modificationQueue
|
204
|
205
|
= async.queue(this._processQueueTasks.bind(this), 1);
|
205
|
206
|
|
|
@@ -242,32 +243,41 @@ export default class JingleSessionPC extends JingleSession {
|
242
|
243
|
}
|
243
|
244
|
|
244
|
245
|
/**
|
245
|
|
- *
|
|
246
|
+ * @inheritDoc
|
|
247
|
+ * @param {JingleSessionPCOptions} options - a set of config options.
|
246
|
248
|
*/
|
247
|
|
- doInitialize() {
|
|
249
|
+ doInitialize(options) {
|
|
250
|
+ this.failICE = Boolean(options.failICE);
|
248
|
251
|
this.lasticecandidate = false;
|
|
252
|
+ this.options = options;
|
249
|
253
|
|
250
|
|
- // True if reconnect is in progress
|
|
254
|
+ /**
|
|
255
|
+ * {@code true} if reconnect is in progress.
|
|
256
|
+ * @type {boolean}
|
|
257
|
+ */
|
251
|
258
|
this.isReconnect = false;
|
252
|
259
|
|
253
|
|
- // Set to true if the connection was ever stable
|
|
260
|
+ /**
|
|
261
|
+ * Set to {@code true} if the connection was ever stable
|
|
262
|
+ * @type {boolean}
|
|
263
|
+ */
|
254
|
264
|
this.wasstable = false;
|
|
265
|
+ this.webrtcIceUdpDisable = Boolean(options.webrtcIceUdpDisable);
|
|
266
|
+ this.webrtcIceTcpDisable = Boolean(options.webrtcIceTcpDisable);
|
255
|
267
|
|
256
|
|
- const pcOptions = { disableRtx: this.room.options.disableRtx };
|
|
268
|
+ const pcOptions = { disableRtx: options.disableRtx };
|
257
|
269
|
|
258
|
|
- if (this.room.options.gatherStats) {
|
|
270
|
+ if (options.gatherStats) {
|
259
|
271
|
pcOptions.maxstats = DEFAULT_MAX_STATS;
|
260
|
272
|
}
|
261
|
273
|
|
262
|
274
|
if (this.isP2P) {
|
263
|
275
|
// simulcast needs to be disabled for P2P (121) calls
|
264
|
276
|
pcOptions.disableSimulcast = true;
|
265
|
|
- pcOptions.disableH264
|
266
|
|
- = this.room.options.p2p && this.room.options.p2p.disableH264;
|
267
|
|
- pcOptions.preferH264
|
268
|
|
- = this.room.options.p2p && this.room.options.p2p.preferH264;
|
|
277
|
+ pcOptions.disableH264 = options.p2p && options.p2p.disableH264;
|
|
278
|
+ pcOptions.preferH264 = options.p2p && options.p2p.preferH264;
|
269
|
279
|
|
270
|
|
- const abtestSuspendVideo = this._abtestSuspendVideoEnabled();
|
|
280
|
+ const abtestSuspendVideo = this._abtestSuspendVideoEnabled(options);
|
271
|
281
|
|
272
|
282
|
if (typeof abtestSuspendVideo !== 'undefined') {
|
273
|
283
|
pcOptions.abtestSuspendVideo = abtestSuspendVideo;
|
|
@@ -275,15 +285,12 @@ export default class JingleSessionPC extends JingleSession {
|
275
|
285
|
} else {
|
276
|
286
|
// H264 does not support simulcast, so it needs to be disabled.
|
277
|
287
|
pcOptions.disableSimulcast
|
278
|
|
- = this.room.options.disableSimulcast
|
279
|
|
- || (this.room.options.preferH264
|
280
|
|
- && !this.room.options.disableH264);
|
281
|
|
- pcOptions.preferH264 = this.room.options.preferH264;
|
|
288
|
+ = options.disableSimulcast
|
|
289
|
+ || (options.preferH264 && !options.disableH264);
|
|
290
|
+ pcOptions.preferH264 = options.preferH264;
|
282
|
291
|
pcOptions.enableFirefoxSimulcast
|
283
|
|
- = this.room.options.testing
|
284
|
|
- && this.room.options.testing.enableFirefoxSimulcast;
|
285
|
|
- pcOptions.enableLayerSuspension
|
286
|
|
- = this.room.options.enableLayerSuspension;
|
|
292
|
+ = options.testing && options.testing.enableFirefoxSimulcast;
|
|
293
|
+ pcOptions.enableLayerSuspension = options.enableLayerSuspension;
|
287
|
294
|
}
|
288
|
295
|
|
289
|
296
|
this.peerconnection
|
|
@@ -480,7 +487,7 @@ export default class JingleSessionPC extends JingleSession {
|
480
|
487
|
// The signaling layer will bind it's listeners at this point
|
481
|
488
|
this.signalingLayer.setChatRoom(this.room);
|
482
|
489
|
|
483
|
|
- if (!this.isP2P && this.room.options.enableLayerSuspension) {
|
|
490
|
+ if (!this.isP2P && options.enableLayerSuspension) {
|
484
|
491
|
// If this is the bridge session, we'll listen for
|
485
|
492
|
// IS_SELECTED_CHANGED events and notify the peer connection
|
486
|
493
|
this.rtc.addListener(RTCEvents.IS_SELECTED_CHANGED,
|
|
@@ -953,6 +960,8 @@ export default class JingleSessionPC extends JingleSession {
|
953
|
960
|
`Error renegotiating after setting new remote ${
|
954
|
961
|
this.isInitiator ? 'answer: ' : 'offer: '}${error}`,
|
955
|
962
|
newRemoteSdp);
|
|
963
|
+
|
|
964
|
+ // FIXME remove static method - there's no need
|
956
|
965
|
JingleSessionPC.onJingleFatalError(this, error);
|
957
|
966
|
finishedCallback(error);
|
958
|
967
|
});
|
|
@@ -2240,10 +2249,10 @@ export default class JingleSessionPC extends JingleSession {
|
2240
|
2249
|
* If the A/B test for suspend video is disabled according to the room's
|
2241
|
2250
|
* configuration, returns undefined. Otherwise returns a boolean which
|
2242
|
2251
|
* indicates whether the suspend video option should be enabled or disabled.
|
|
2252
|
+ * @param {JingleSessionPCOptions} options - The config options.
|
2243
|
2253
|
*/
|
2244
|
|
- _abtestSuspendVideoEnabled() {
|
2245
|
|
- if (!this.room.options.abTesting
|
2246
|
|
- || !this.room.options.abTesting.enableSuspendVideoTest) {
|
|
2254
|
+ _abtestSuspendVideoEnabled({ abTesting }) {
|
|
2255
|
+ if (!abTesting || !abTesting.enableSuspendVideoTest) {
|
2247
|
2256
|
return;
|
2248
|
2257
|
}
|
2249
|
2258
|
|