|
@@ -1,6 +1,7 @@
|
1
|
1
|
import { getLogger } from 'jitsi-meet-logger';
|
2
|
2
|
import transform from 'sdp-transform';
|
3
|
3
|
|
|
4
|
+import MediaDirection from '../../service/RTC/MediaDirection';
|
4
|
5
|
import * as MediaType from '../../service/RTC/MediaType';
|
5
|
6
|
import browser from '../browser';
|
6
|
7
|
|
|
@@ -9,13 +10,6 @@ const SIM_LAYER_1_RID = '1';
|
9
|
10
|
const SIM_LAYER_2_RID = '2';
|
10
|
11
|
const SIM_LAYER_3_RID = '3';
|
11
|
12
|
|
12
|
|
-const TransceiverDirection = {
|
13
|
|
- INACTIVE: 'inactive',
|
14
|
|
- RECVONLY: 'recvonly',
|
15
|
|
- SENDONLY: 'sendonly',
|
16
|
|
- SENDRECV: 'sendrecv'
|
17
|
|
-};
|
18
|
|
-
|
19
|
13
|
export const SIM_LAYER_RIDS = [ SIM_LAYER_1_RID, SIM_LAYER_2_RID, SIM_LAYER_3_RID ];
|
20
|
14
|
|
21
|
15
|
/**
|
|
@@ -234,7 +228,7 @@ export class TPCUtils {
|
234
|
228
|
// Use pc.addTransceiver() for the initiator case when local tracks are getting added
|
235
|
229
|
// to the peerconnection before a session-initiate is sent over to the peer.
|
236
|
230
|
const transceiverInit = {
|
237
|
|
- direction: TransceiverDirection.SENDRECV,
|
|
231
|
+ direction: MediaDirection.SENDRECV,
|
238
|
232
|
streams: [ localTrack.getOriginalStream() ],
|
239
|
233
|
sendEncodings: []
|
240
|
234
|
};
|
|
@@ -264,7 +258,7 @@ export class TPCUtils {
|
264
|
258
|
if (!transceiver) {
|
265
|
259
|
return Promise.reject(new Error(`RTCRtpTransceiver for ${mediaType} not found`));
|
266
|
260
|
}
|
267
|
|
- logger.debug(`Adding ${localTrack} on ${this.pc}`);
|
|
261
|
+ logger.debug(`${this.pc} Adding ${localTrack}`);
|
268
|
262
|
|
269
|
263
|
return transceiver.sender.replaceTrack(track);
|
270
|
264
|
}
|
|
@@ -308,7 +302,7 @@ export class TPCUtils {
|
308
|
302
|
return Promise.reject(new Error(`RTCRtpTransceiver for ${mediaType} not found`));
|
309
|
303
|
}
|
310
|
304
|
|
311
|
|
- logger.debug(`Removing ${localTrack} on ${this.pc}`);
|
|
305
|
+ logger.debug(`${this.pc} Removing ${localTrack}`);
|
312
|
306
|
|
313
|
307
|
return transceiver.sender.replaceTrack(null);
|
314
|
308
|
}
|
|
@@ -341,7 +335,7 @@ export class TPCUtils {
|
341
|
335
|
if (!transceiver) {
|
342
|
336
|
return Promise.reject(new Error('replace track failed'));
|
343
|
337
|
}
|
344
|
|
- logger.debug(`Replacing ${oldTrack} with ${newTrack} on ${this.pc}`);
|
|
338
|
+ logger.debug(`${this.pc} Replacing ${oldTrack} with ${newTrack}`);
|
345
|
339
|
|
346
|
340
|
return transceiver.sender.replaceTrack(track)
|
347
|
341
|
.then(() => {
|
|
@@ -364,7 +358,7 @@ export class TPCUtils {
|
364
|
358
|
// Change the direction on the transceiver to 'recvonly' so that a 'removetrack'
|
365
|
359
|
// is fired on the associated media stream on the remote peer.
|
366
|
360
|
if (transceiver) {
|
367
|
|
- transceiver.direction = TransceiverDirection.RECVONLY;
|
|
361
|
+ transceiver.direction = MediaDirection.RECVONLY;
|
368
|
362
|
}
|
369
|
363
|
|
370
|
364
|
// Remove the old track from the list of local tracks.
|
|
@@ -380,7 +374,7 @@ export class TPCUtils {
|
380
|
374
|
// Change the direction on the transceiver back to 'sendrecv' so that a 'track'
|
381
|
375
|
// event is fired on the remote peer.
|
382
|
376
|
if (transceiver) {
|
383
|
|
- transceiver.direction = TransceiverDirection.SENDRECV;
|
|
377
|
+ transceiver.direction = MediaDirection.SENDRECV;
|
384
|
378
|
}
|
385
|
379
|
|
386
|
380
|
// Avoid configuring the encodings on Chromium/Safari until simulcast is configured
|
|
@@ -397,7 +391,7 @@ export class TPCUtils {
|
397
|
391
|
});
|
398
|
392
|
}
|
399
|
393
|
|
400
|
|
- logger.info('TPCUtils.replaceTrack called with no new track and no old track');
|
|
394
|
+ logger.info(`${this.pc} TPCUtils.replaceTrack called with no new track and no old track`);
|
401
|
395
|
|
402
|
396
|
return Promise.resolve();
|
403
|
397
|
}
|
|
@@ -450,17 +444,17 @@ export class TPCUtils {
|
450
|
444
|
.filter(t => t.receiver && t.receiver.track && t.receiver.track.kind === mediaType);
|
451
|
445
|
const localTracks = this.pc.getLocalTracks(mediaType);
|
452
|
446
|
|
453
|
|
- logger.info(`${active ? 'Enabling' : 'Suspending'} ${mediaType} media transfer on ${this.pc}`);
|
|
447
|
+ logger.info(`${this.pc} ${active ? 'Enabling' : 'Suspending'} ${mediaType} media transfer.`);
|
454
|
448
|
transceivers.forEach((transceiver, idx) => {
|
455
|
449
|
if (active) {
|
456
|
450
|
// The first transceiver is for the local track and only this one can be set to 'sendrecv'
|
457
|
451
|
if (idx === 0 && localTracks.length) {
|
458
|
|
- transceiver.direction = TransceiverDirection.SENDRECV;
|
|
452
|
+ transceiver.direction = MediaDirection.SENDRECV;
|
459
|
453
|
} else {
|
460
|
|
- transceiver.direction = TransceiverDirection.RECVONLY;
|
|
454
|
+ transceiver.direction = MediaDirection.RECVONLY;
|
461
|
455
|
}
|
462
|
456
|
} else {
|
463
|
|
- transceiver.direction = TransceiverDirection.INACTIVE;
|
|
457
|
+ transceiver.direction = MediaDirection.INACTIVE;
|
464
|
458
|
}
|
465
|
459
|
});
|
466
|
460
|
}
|