mediasoup-client 3.6.96 → 3.6.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Device.js +5 -6
- package/lib/handlers/Chrome111.js +4 -8
- package/lib/handlers/Chrome55.js +4 -8
- package/lib/handlers/Chrome67.js +4 -8
- package/lib/handlers/Chrome70.js +4 -8
- package/lib/handlers/Chrome74.js +4 -8
- package/lib/handlers/ReactNative.js +4 -8
- package/lib/handlers/ReactNativeUnifiedPlan.js +5 -9
- package/lib/handlers/Safari11.js +4 -8
- package/lib/handlers/Safari12.js +4 -8
- package/lib/handlers/ortc/utils.js +1 -2
- package/lib/handlers/sdp/MediaSection.js +1 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/tests/test.js +34 -44
- package/package.json +1 -1
package/lib/Device.js
CHANGED
|
@@ -44,7 +44,6 @@ const ReactNativeUnifiedPlan_1 = require("./handlers/ReactNativeUnifiedPlan");
|
|
|
44
44
|
const ReactNative_1 = require("./handlers/ReactNative");
|
|
45
45
|
const logger = new Logger_1.Logger('Device');
|
|
46
46
|
function detectDevice() {
|
|
47
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
48
47
|
// React-Native.
|
|
49
48
|
// NOTE: react-native-webrtc >= 1.75.0 is required.
|
|
50
49
|
// NOTE: react-native-webrtc with Unified Plan requires version >= 106.0.0.
|
|
@@ -69,13 +68,13 @@ function detectDevice() {
|
|
|
69
68
|
const uaParser = new ua_parser_js_1.UAParser(ua);
|
|
70
69
|
logger.debug('detectDevice() | browser detected [ua:%s, parsed:%o]', ua, uaParser.getResult());
|
|
71
70
|
const browser = uaParser.getBrowser();
|
|
72
|
-
const browserName =
|
|
73
|
-
const browserVersion = parseInt(
|
|
71
|
+
const browserName = browser.name?.toLowerCase() ?? '';
|
|
72
|
+
const browserVersion = parseInt(browser.major ?? '0');
|
|
74
73
|
const engine = uaParser.getEngine();
|
|
75
|
-
const engineName =
|
|
74
|
+
const engineName = engine.name?.toLowerCase() ?? '';
|
|
76
75
|
const os = uaParser.getOS();
|
|
77
|
-
const osName =
|
|
78
|
-
const osVersion = parseFloat(
|
|
76
|
+
const osName = os.name?.toLowerCase() ?? '';
|
|
77
|
+
const osVersion = parseFloat(os.version ?? '0');
|
|
79
78
|
const isIOS = osName === 'ios';
|
|
80
79
|
const isChrome = [
|
|
81
80
|
'chrome',
|
|
@@ -213,7 +213,6 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
|
|
|
213
213
|
return this._pc.getStats();
|
|
214
214
|
}
|
|
215
215
|
async send({ track, encodings, codecOptions, codec }) {
|
|
216
|
-
var _a;
|
|
217
216
|
this.assertNotClosed();
|
|
218
217
|
this.assertSendDirection();
|
|
219
218
|
logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
|
|
@@ -259,7 +258,7 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
|
|
|
259
258
|
let localSdpObject = sdpTransform.parse(offer.sdp);
|
|
260
259
|
if (!this._transportReady) {
|
|
261
260
|
await this.setupTransport({
|
|
262
|
-
localDtlsRole:
|
|
261
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
263
262
|
localSdpObject
|
|
264
263
|
});
|
|
265
264
|
}
|
|
@@ -442,7 +441,6 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
|
|
|
442
441
|
return transceiver.sender.getStats();
|
|
443
442
|
}
|
|
444
443
|
async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
|
|
445
|
-
var _a;
|
|
446
444
|
this.assertNotClosed();
|
|
447
445
|
this.assertSendDirection();
|
|
448
446
|
const options = {
|
|
@@ -467,7 +465,7 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
|
|
|
467
465
|
.find((m) => m.type === 'application');
|
|
468
466
|
if (!this._transportReady) {
|
|
469
467
|
await this.setupTransport({
|
|
470
|
-
localDtlsRole:
|
|
468
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
471
469
|
localSdpObject
|
|
472
470
|
});
|
|
473
471
|
}
|
|
@@ -488,7 +486,6 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
|
|
|
488
486
|
return { dataChannel, sctpStreamParameters };
|
|
489
487
|
}
|
|
490
488
|
async receive(optionsList) {
|
|
491
|
-
var _a;
|
|
492
489
|
this.assertNotClosed();
|
|
493
490
|
this.assertRecvDirection();
|
|
494
491
|
const results = [];
|
|
@@ -526,7 +523,7 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
|
|
|
526
523
|
answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
|
|
527
524
|
if (!this._transportReady) {
|
|
528
525
|
await this.setupTransport({
|
|
529
|
-
localDtlsRole:
|
|
526
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
530
527
|
localSdpObject
|
|
531
528
|
});
|
|
532
529
|
}
|
|
@@ -623,7 +620,6 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
|
|
|
623
620
|
return transceiver.receiver.getStats();
|
|
624
621
|
}
|
|
625
622
|
async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
|
|
626
|
-
var _a;
|
|
627
623
|
this.assertNotClosed();
|
|
628
624
|
this.assertRecvDirection();
|
|
629
625
|
const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
|
|
@@ -648,7 +644,7 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
|
|
|
648
644
|
if (!this._transportReady) {
|
|
649
645
|
const localSdpObject = sdpTransform.parse(answer.sdp);
|
|
650
646
|
await this.setupTransport({
|
|
651
|
-
localDtlsRole:
|
|
647
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
652
648
|
localSdpObject
|
|
653
649
|
});
|
|
654
650
|
}
|
package/lib/handlers/Chrome55.js
CHANGED
|
@@ -206,7 +206,6 @@ class Chrome55 extends HandlerInterface_1.HandlerInterface {
|
|
|
206
206
|
return this._pc.getStats();
|
|
207
207
|
}
|
|
208
208
|
async send({ track, encodings, codecOptions, codec }) {
|
|
209
|
-
var _a;
|
|
210
209
|
this.assertSendDirection();
|
|
211
210
|
logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
|
|
212
211
|
if (codec) {
|
|
@@ -225,7 +224,7 @@ class Chrome55 extends HandlerInterface_1.HandlerInterface {
|
|
|
225
224
|
ortc.reduceCodecs(sendingRemoteRtpParameters.codecs);
|
|
226
225
|
if (!this._transportReady) {
|
|
227
226
|
await this.setupTransport({
|
|
228
|
-
localDtlsRole:
|
|
227
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
229
228
|
localSdpObject
|
|
230
229
|
});
|
|
231
230
|
}
|
|
@@ -342,7 +341,6 @@ class Chrome55 extends HandlerInterface_1.HandlerInterface {
|
|
|
342
341
|
throw new errors_1.UnsupportedError('not implemented');
|
|
343
342
|
}
|
|
344
343
|
async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
|
|
345
|
-
var _a;
|
|
346
344
|
this.assertSendDirection();
|
|
347
345
|
const options = {
|
|
348
346
|
negotiated: true,
|
|
@@ -367,7 +365,7 @@ class Chrome55 extends HandlerInterface_1.HandlerInterface {
|
|
|
367
365
|
.find((m) => m.type === 'application');
|
|
368
366
|
if (!this._transportReady) {
|
|
369
367
|
await this.setupTransport({
|
|
370
|
-
localDtlsRole:
|
|
368
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
371
369
|
localSdpObject
|
|
372
370
|
});
|
|
373
371
|
}
|
|
@@ -388,7 +386,6 @@ class Chrome55 extends HandlerInterface_1.HandlerInterface {
|
|
|
388
386
|
return { dataChannel, sctpStreamParameters };
|
|
389
387
|
}
|
|
390
388
|
async receive(optionsList) {
|
|
391
|
-
var _a;
|
|
392
389
|
this.assertRecvDirection();
|
|
393
390
|
const results = [];
|
|
394
391
|
for (const options of optionsList) {
|
|
@@ -423,7 +420,7 @@ class Chrome55 extends HandlerInterface_1.HandlerInterface {
|
|
|
423
420
|
answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
|
|
424
421
|
if (!this._transportReady) {
|
|
425
422
|
await this.setupTransport({
|
|
426
|
-
localDtlsRole:
|
|
423
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
427
424
|
localSdpObject
|
|
428
425
|
});
|
|
429
426
|
}
|
|
@@ -477,7 +474,6 @@ class Chrome55 extends HandlerInterface_1.HandlerInterface {
|
|
|
477
474
|
throw new errors_1.UnsupportedError('not implemented');
|
|
478
475
|
}
|
|
479
476
|
async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
|
|
480
|
-
var _a;
|
|
481
477
|
this.assertRecvDirection();
|
|
482
478
|
const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
|
|
483
479
|
const options = {
|
|
@@ -502,7 +498,7 @@ class Chrome55 extends HandlerInterface_1.HandlerInterface {
|
|
|
502
498
|
if (!this._transportReady) {
|
|
503
499
|
const localSdpObject = sdpTransform.parse(answer.sdp);
|
|
504
500
|
await this.setupTransport({
|
|
505
|
-
localDtlsRole:
|
|
501
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
506
502
|
localSdpObject
|
|
507
503
|
});
|
|
508
504
|
}
|
package/lib/handlers/Chrome67.js
CHANGED
|
@@ -205,7 +205,6 @@ class Chrome67 extends HandlerInterface_1.HandlerInterface {
|
|
|
205
205
|
return this._pc.getStats();
|
|
206
206
|
}
|
|
207
207
|
async send({ track, encodings, codecOptions, codec }) {
|
|
208
|
-
var _a;
|
|
209
208
|
this.assertSendDirection();
|
|
210
209
|
logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
|
|
211
210
|
if (codec) {
|
|
@@ -224,7 +223,7 @@ class Chrome67 extends HandlerInterface_1.HandlerInterface {
|
|
|
224
223
|
ortc.reduceCodecs(sendingRemoteRtpParameters.codecs);
|
|
225
224
|
if (!this._transportReady) {
|
|
226
225
|
await this.setupTransport({
|
|
227
|
-
localDtlsRole:
|
|
226
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
228
227
|
localSdpObject
|
|
229
228
|
});
|
|
230
229
|
}
|
|
@@ -392,7 +391,6 @@ class Chrome67 extends HandlerInterface_1.HandlerInterface {
|
|
|
392
391
|
return rtpSender.getStats();
|
|
393
392
|
}
|
|
394
393
|
async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
|
|
395
|
-
var _a;
|
|
396
394
|
this.assertSendDirection();
|
|
397
395
|
const options = {
|
|
398
396
|
negotiated: true,
|
|
@@ -417,7 +415,7 @@ class Chrome67 extends HandlerInterface_1.HandlerInterface {
|
|
|
417
415
|
.find((m) => m.type === 'application');
|
|
418
416
|
if (!this._transportReady) {
|
|
419
417
|
await this.setupTransport({
|
|
420
|
-
localDtlsRole:
|
|
418
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
421
419
|
localSdpObject
|
|
422
420
|
});
|
|
423
421
|
}
|
|
@@ -438,7 +436,6 @@ class Chrome67 extends HandlerInterface_1.HandlerInterface {
|
|
|
438
436
|
return { dataChannel, sctpStreamParameters };
|
|
439
437
|
}
|
|
440
438
|
async receive(optionsList) {
|
|
441
|
-
var _a;
|
|
442
439
|
this.assertRecvDirection();
|
|
443
440
|
const results = [];
|
|
444
441
|
for (const options of optionsList) {
|
|
@@ -473,7 +470,7 @@ class Chrome67 extends HandlerInterface_1.HandlerInterface {
|
|
|
473
470
|
answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
|
|
474
471
|
if (!this._transportReady) {
|
|
475
472
|
await this.setupTransport({
|
|
476
|
-
localDtlsRole:
|
|
473
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
477
474
|
localSdpObject
|
|
478
475
|
});
|
|
479
476
|
}
|
|
@@ -533,7 +530,6 @@ class Chrome67 extends HandlerInterface_1.HandlerInterface {
|
|
|
533
530
|
return rtpReceiver.getStats();
|
|
534
531
|
}
|
|
535
532
|
async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
|
|
536
|
-
var _a;
|
|
537
533
|
this.assertRecvDirection();
|
|
538
534
|
const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
|
|
539
535
|
const options = {
|
|
@@ -558,7 +554,7 @@ class Chrome67 extends HandlerInterface_1.HandlerInterface {
|
|
|
558
554
|
if (!this._transportReady) {
|
|
559
555
|
const localSdpObject = sdpTransform.parse(answer.sdp);
|
|
560
556
|
await this.setupTransport({
|
|
561
|
-
localDtlsRole:
|
|
557
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
562
558
|
localSdpObject
|
|
563
559
|
});
|
|
564
560
|
}
|
package/lib/handlers/Chrome70.js
CHANGED
|
@@ -199,7 +199,6 @@ class Chrome70 extends HandlerInterface_1.HandlerInterface {
|
|
|
199
199
|
return this._pc.getStats();
|
|
200
200
|
}
|
|
201
201
|
async send({ track, encodings, codecOptions, codec }) {
|
|
202
|
-
var _a;
|
|
203
202
|
this.assertSendDirection();
|
|
204
203
|
logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
|
|
205
204
|
const sendingRtpParameters = utils.clone(this._sendingRtpParametersByKind[track.kind], {});
|
|
@@ -217,7 +216,7 @@ class Chrome70 extends HandlerInterface_1.HandlerInterface {
|
|
|
217
216
|
let offerMediaObject;
|
|
218
217
|
if (!this._transportReady) {
|
|
219
218
|
await this.setupTransport({
|
|
220
|
-
localDtlsRole:
|
|
219
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
221
220
|
localSdpObject
|
|
222
221
|
});
|
|
223
222
|
}
|
|
@@ -416,7 +415,6 @@ class Chrome70 extends HandlerInterface_1.HandlerInterface {
|
|
|
416
415
|
return transceiver.sender.getStats();
|
|
417
416
|
}
|
|
418
417
|
async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
|
|
419
|
-
var _a;
|
|
420
418
|
this.assertSendDirection();
|
|
421
419
|
const options = {
|
|
422
420
|
negotiated: true,
|
|
@@ -441,7 +439,7 @@ class Chrome70 extends HandlerInterface_1.HandlerInterface {
|
|
|
441
439
|
.find((m) => m.type === 'application');
|
|
442
440
|
if (!this._transportReady) {
|
|
443
441
|
await this.setupTransport({
|
|
444
|
-
localDtlsRole:
|
|
442
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
445
443
|
localSdpObject
|
|
446
444
|
});
|
|
447
445
|
}
|
|
@@ -462,7 +460,6 @@ class Chrome70 extends HandlerInterface_1.HandlerInterface {
|
|
|
462
460
|
return { dataChannel, sctpStreamParameters };
|
|
463
461
|
}
|
|
464
462
|
async receive(optionsList) {
|
|
465
|
-
var _a;
|
|
466
463
|
this.assertRecvDirection();
|
|
467
464
|
const results = [];
|
|
468
465
|
const mapLocalId = new Map();
|
|
@@ -499,7 +496,7 @@ class Chrome70 extends HandlerInterface_1.HandlerInterface {
|
|
|
499
496
|
answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
|
|
500
497
|
if (!this._transportReady) {
|
|
501
498
|
await this.setupTransport({
|
|
502
|
-
localDtlsRole:
|
|
499
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
503
500
|
localSdpObject
|
|
504
501
|
});
|
|
505
502
|
}
|
|
@@ -562,7 +559,6 @@ class Chrome70 extends HandlerInterface_1.HandlerInterface {
|
|
|
562
559
|
return transceiver.receiver.getStats();
|
|
563
560
|
}
|
|
564
561
|
async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
|
|
565
|
-
var _a;
|
|
566
562
|
this.assertRecvDirection();
|
|
567
563
|
const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
|
|
568
564
|
const options = {
|
|
@@ -587,7 +583,7 @@ class Chrome70 extends HandlerInterface_1.HandlerInterface {
|
|
|
587
583
|
if (!this._transportReady) {
|
|
588
584
|
const localSdpObject = sdpTransform.parse(answer.sdp);
|
|
589
585
|
await this.setupTransport({
|
|
590
|
-
localDtlsRole:
|
|
586
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
591
587
|
localSdpObject
|
|
592
588
|
});
|
|
593
589
|
}
|
package/lib/handlers/Chrome74.js
CHANGED
|
@@ -212,7 +212,6 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
212
212
|
return this._pc.getStats();
|
|
213
213
|
}
|
|
214
214
|
async send({ track, encodings, codecOptions, codec }) {
|
|
215
|
-
var _a;
|
|
216
215
|
this.assertNotClosed();
|
|
217
216
|
this.assertSendDirection();
|
|
218
217
|
logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
|
|
@@ -240,7 +239,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
240
239
|
let offerMediaObject;
|
|
241
240
|
if (!this._transportReady) {
|
|
242
241
|
await this.setupTransport({
|
|
243
|
-
localDtlsRole:
|
|
242
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
244
243
|
localSdpObject
|
|
245
244
|
});
|
|
246
245
|
}
|
|
@@ -458,7 +457,6 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
458
457
|
return transceiver.sender.getStats();
|
|
459
458
|
}
|
|
460
459
|
async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
|
|
461
|
-
var _a;
|
|
462
460
|
this.assertNotClosed();
|
|
463
461
|
this.assertSendDirection();
|
|
464
462
|
const options = {
|
|
@@ -483,7 +481,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
483
481
|
.find((m) => m.type === 'application');
|
|
484
482
|
if (!this._transportReady) {
|
|
485
483
|
await this.setupTransport({
|
|
486
|
-
localDtlsRole:
|
|
484
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
487
485
|
localSdpObject
|
|
488
486
|
});
|
|
489
487
|
}
|
|
@@ -504,7 +502,6 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
504
502
|
return { dataChannel, sctpStreamParameters };
|
|
505
503
|
}
|
|
506
504
|
async receive(optionsList) {
|
|
507
|
-
var _a;
|
|
508
505
|
this.assertNotClosed();
|
|
509
506
|
this.assertRecvDirection();
|
|
510
507
|
const results = [];
|
|
@@ -542,7 +539,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
542
539
|
answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
|
|
543
540
|
if (!this._transportReady) {
|
|
544
541
|
await this.setupTransport({
|
|
545
|
-
localDtlsRole:
|
|
542
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
546
543
|
localSdpObject
|
|
547
544
|
});
|
|
548
545
|
}
|
|
@@ -639,7 +636,6 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
639
636
|
return transceiver.receiver.getStats();
|
|
640
637
|
}
|
|
641
638
|
async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
|
|
642
|
-
var _a;
|
|
643
639
|
this.assertNotClosed();
|
|
644
640
|
this.assertRecvDirection();
|
|
645
641
|
const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
|
|
@@ -664,7 +660,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
664
660
|
if (!this._transportReady) {
|
|
665
661
|
const localSdpObject = sdpTransform.parse(answer.sdp);
|
|
666
662
|
await this.setupTransport({
|
|
667
|
-
localDtlsRole:
|
|
663
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
668
664
|
localSdpObject
|
|
669
665
|
});
|
|
670
666
|
}
|
|
@@ -210,7 +210,6 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
|
|
|
210
210
|
return this._pc.getStats();
|
|
211
211
|
}
|
|
212
212
|
async send({ track, encodings, codecOptions, codec }) {
|
|
213
|
-
var _a;
|
|
214
213
|
this.assertSendDirection();
|
|
215
214
|
logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
|
|
216
215
|
if (codec) {
|
|
@@ -229,7 +228,7 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
|
|
|
229
228
|
ortc.reduceCodecs(sendingRemoteRtpParameters.codecs);
|
|
230
229
|
if (!this._transportReady) {
|
|
231
230
|
await this.setupTransport({
|
|
232
|
-
localDtlsRole:
|
|
231
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
233
232
|
localSdpObject
|
|
234
233
|
});
|
|
235
234
|
}
|
|
@@ -348,7 +347,6 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
|
|
|
348
347
|
throw new errors_1.UnsupportedError('not implemented');
|
|
349
348
|
}
|
|
350
349
|
async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
|
|
351
|
-
var _a;
|
|
352
350
|
this.assertSendDirection();
|
|
353
351
|
const options = {
|
|
354
352
|
negotiated: true,
|
|
@@ -373,7 +371,7 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
|
|
|
373
371
|
.find((m) => m.type === 'application');
|
|
374
372
|
if (!this._transportReady) {
|
|
375
373
|
await this.setupTransport({
|
|
376
|
-
localDtlsRole:
|
|
374
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
377
375
|
localSdpObject
|
|
378
376
|
});
|
|
379
377
|
}
|
|
@@ -394,7 +392,6 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
|
|
|
394
392
|
return { dataChannel, sctpStreamParameters };
|
|
395
393
|
}
|
|
396
394
|
async receive(optionsList) {
|
|
397
|
-
var _a;
|
|
398
395
|
this.assertRecvDirection();
|
|
399
396
|
const results = [];
|
|
400
397
|
const mapStreamId = new Map();
|
|
@@ -439,7 +436,7 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
|
|
|
439
436
|
answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
|
|
440
437
|
if (!this._transportReady) {
|
|
441
438
|
await this.setupTransport({
|
|
442
|
-
localDtlsRole:
|
|
439
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
443
440
|
localSdpObject
|
|
444
441
|
});
|
|
445
442
|
}
|
|
@@ -493,7 +490,6 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
|
|
|
493
490
|
throw new errors_1.UnsupportedError('not implemented');
|
|
494
491
|
}
|
|
495
492
|
async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
|
|
496
|
-
var _a;
|
|
497
493
|
this.assertRecvDirection();
|
|
498
494
|
const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
|
|
499
495
|
const options = {
|
|
@@ -518,7 +514,7 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
|
|
|
518
514
|
if (!this._transportReady) {
|
|
519
515
|
const localSdpObject = sdpTransform.parse(answer.sdp);
|
|
520
516
|
await this.setupTransport({
|
|
521
|
-
localDtlsRole:
|
|
517
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
522
518
|
localSdpObject
|
|
523
519
|
});
|
|
524
520
|
}
|
|
@@ -217,7 +217,6 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
|
|
|
217
217
|
return this._pc.getStats();
|
|
218
218
|
}
|
|
219
219
|
async send({ track, encodings, codecOptions, codec }) {
|
|
220
|
-
var _a, _b;
|
|
221
220
|
this.assertNotClosed();
|
|
222
221
|
this.assertSendDirection();
|
|
223
222
|
logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
|
|
@@ -245,7 +244,7 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
|
|
|
245
244
|
let offerMediaObject;
|
|
246
245
|
if (!this._transportReady) {
|
|
247
246
|
await this.setupTransport({
|
|
248
|
-
localDtlsRole:
|
|
247
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
249
248
|
localSdpObject
|
|
250
249
|
});
|
|
251
250
|
}
|
|
@@ -275,7 +274,7 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
|
|
|
275
274
|
// Issue: https://github.com/react-native-webrtc/react-native-webrtc/issues/1404
|
|
276
275
|
// NOTE: So let's fill MID in sendingRtpParameters later.
|
|
277
276
|
// NOTE: This is fixed in react-native-webrtc 111.0.3.
|
|
278
|
-
let localId =
|
|
277
|
+
let localId = transceiver.mid ?? undefined;
|
|
279
278
|
if (!localId) {
|
|
280
279
|
logger.warn('send() | missing transceiver.mid (bug in react-native-webrtc, using a workaround');
|
|
281
280
|
}
|
|
@@ -481,7 +480,6 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
|
|
|
481
480
|
return transceiver.sender.getStats();
|
|
482
481
|
}
|
|
483
482
|
async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
|
|
484
|
-
var _a;
|
|
485
483
|
this.assertNotClosed();
|
|
486
484
|
this.assertSendDirection();
|
|
487
485
|
const options = {
|
|
@@ -506,7 +504,7 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
|
|
|
506
504
|
.find((m) => m.type === 'application');
|
|
507
505
|
if (!this._transportReady) {
|
|
508
506
|
await this.setupTransport({
|
|
509
|
-
localDtlsRole:
|
|
507
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
510
508
|
localSdpObject
|
|
511
509
|
});
|
|
512
510
|
}
|
|
@@ -527,7 +525,6 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
|
|
|
527
525
|
return { dataChannel, sctpStreamParameters };
|
|
528
526
|
}
|
|
529
527
|
async receive(optionsList) {
|
|
530
|
-
var _a;
|
|
531
528
|
this.assertNotClosed();
|
|
532
529
|
this.assertRecvDirection();
|
|
533
530
|
const results = [];
|
|
@@ -565,7 +562,7 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
|
|
|
565
562
|
answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
|
|
566
563
|
if (!this._transportReady) {
|
|
567
564
|
await this.setupTransport({
|
|
568
|
-
localDtlsRole:
|
|
565
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
569
566
|
localSdpObject
|
|
570
567
|
});
|
|
571
568
|
}
|
|
@@ -662,7 +659,6 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
|
|
|
662
659
|
return transceiver.receiver.getStats();
|
|
663
660
|
}
|
|
664
661
|
async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
|
|
665
|
-
var _a;
|
|
666
662
|
this.assertNotClosed();
|
|
667
663
|
this.assertRecvDirection();
|
|
668
664
|
const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
|
|
@@ -687,7 +683,7 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
|
|
|
687
683
|
if (!this._transportReady) {
|
|
688
684
|
const localSdpObject = sdpTransform.parse(answer.sdp);
|
|
689
685
|
await this.setupTransport({
|
|
690
|
-
localDtlsRole:
|
|
686
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
691
687
|
localSdpObject
|
|
692
688
|
});
|
|
693
689
|
}
|
package/lib/handlers/Safari11.js
CHANGED
|
@@ -204,7 +204,6 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
|
|
|
204
204
|
return this._pc.getStats();
|
|
205
205
|
}
|
|
206
206
|
async send({ track, encodings, codecOptions, codec }) {
|
|
207
|
-
var _a;
|
|
208
207
|
this.assertSendDirection();
|
|
209
208
|
logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
|
|
210
209
|
if (codec) {
|
|
@@ -223,7 +222,7 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
|
|
|
223
222
|
ortc.reduceCodecs(sendingRemoteRtpParameters.codecs);
|
|
224
223
|
if (!this._transportReady) {
|
|
225
224
|
await this.setupTransport({
|
|
226
|
-
localDtlsRole:
|
|
225
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
227
226
|
localSdpObject
|
|
228
227
|
});
|
|
229
228
|
}
|
|
@@ -388,7 +387,6 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
|
|
|
388
387
|
return rtpSender.getStats();
|
|
389
388
|
}
|
|
390
389
|
async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
|
|
391
|
-
var _a;
|
|
392
390
|
this.assertSendDirection();
|
|
393
391
|
const options = {
|
|
394
392
|
negotiated: true,
|
|
@@ -412,7 +410,7 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
|
|
|
412
410
|
.find((m) => m.type === 'application');
|
|
413
411
|
if (!this._transportReady) {
|
|
414
412
|
await this.setupTransport({
|
|
415
|
-
localDtlsRole:
|
|
413
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
416
414
|
localSdpObject
|
|
417
415
|
});
|
|
418
416
|
}
|
|
@@ -433,7 +431,6 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
|
|
|
433
431
|
return { dataChannel, sctpStreamParameters };
|
|
434
432
|
}
|
|
435
433
|
async receive(optionsList) {
|
|
436
|
-
var _a;
|
|
437
434
|
this.assertRecvDirection();
|
|
438
435
|
const results = [];
|
|
439
436
|
for (const options of optionsList) {
|
|
@@ -468,7 +465,7 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
|
|
|
468
465
|
answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
|
|
469
466
|
if (!this._transportReady) {
|
|
470
467
|
await this.setupTransport({
|
|
471
|
-
localDtlsRole:
|
|
468
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
472
469
|
localSdpObject
|
|
473
470
|
});
|
|
474
471
|
}
|
|
@@ -528,7 +525,6 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
|
|
|
528
525
|
// Unimplemented.
|
|
529
526
|
}
|
|
530
527
|
async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
|
|
531
|
-
var _a;
|
|
532
528
|
this.assertRecvDirection();
|
|
533
529
|
const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
|
|
534
530
|
const options = {
|
|
@@ -552,7 +548,7 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
|
|
|
552
548
|
if (!this._transportReady) {
|
|
553
549
|
const localSdpObject = sdpTransform.parse(answer.sdp);
|
|
554
550
|
await this.setupTransport({
|
|
555
|
-
localDtlsRole:
|
|
551
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
556
552
|
localSdpObject
|
|
557
553
|
});
|
|
558
554
|
}
|
package/lib/handlers/Safari12.js
CHANGED
|
@@ -211,7 +211,6 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
211
211
|
return this._pc.getStats();
|
|
212
212
|
}
|
|
213
213
|
async send({ track, encodings, codecOptions, codec }) {
|
|
214
|
-
var _a;
|
|
215
214
|
this.assertNotClosed();
|
|
216
215
|
this.assertSendDirection();
|
|
217
216
|
logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
|
|
@@ -230,7 +229,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
230
229
|
let offerMediaObject;
|
|
231
230
|
if (!this._transportReady) {
|
|
232
231
|
await this.setupTransport({
|
|
233
|
-
localDtlsRole:
|
|
232
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
234
233
|
localSdpObject
|
|
235
234
|
});
|
|
236
235
|
}
|
|
@@ -434,7 +433,6 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
434
433
|
return transceiver.sender.getStats();
|
|
435
434
|
}
|
|
436
435
|
async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
|
|
437
|
-
var _a;
|
|
438
436
|
this.assertNotClosed();
|
|
439
437
|
this.assertSendDirection();
|
|
440
438
|
const options = {
|
|
@@ -459,7 +457,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
459
457
|
.find((m) => m.type === 'application');
|
|
460
458
|
if (!this._transportReady) {
|
|
461
459
|
await this.setupTransport({
|
|
462
|
-
localDtlsRole:
|
|
460
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
463
461
|
localSdpObject
|
|
464
462
|
});
|
|
465
463
|
}
|
|
@@ -480,7 +478,6 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
480
478
|
return { dataChannel, sctpStreamParameters };
|
|
481
479
|
}
|
|
482
480
|
async receive(optionsList) {
|
|
483
|
-
var _a;
|
|
484
481
|
this.assertNotClosed();
|
|
485
482
|
this.assertRecvDirection();
|
|
486
483
|
const results = [];
|
|
@@ -518,7 +515,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
518
515
|
answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
|
|
519
516
|
if (!this._transportReady) {
|
|
520
517
|
await this.setupTransport({
|
|
521
|
-
localDtlsRole:
|
|
518
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
522
519
|
localSdpObject
|
|
523
520
|
});
|
|
524
521
|
}
|
|
@@ -613,7 +610,6 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
613
610
|
return transceiver.receiver.getStats();
|
|
614
611
|
}
|
|
615
612
|
async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
|
|
616
|
-
var _a;
|
|
617
613
|
this.assertNotClosed();
|
|
618
614
|
this.assertRecvDirection();
|
|
619
615
|
const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
|
|
@@ -638,7 +634,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
|
|
|
638
634
|
if (!this._transportReady) {
|
|
639
635
|
const localSdpObject = sdpTransform.parse(answer.sdp);
|
|
640
636
|
await this.setupTransport({
|
|
641
|
-
localDtlsRole:
|
|
637
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
642
638
|
localSdpObject
|
|
643
639
|
});
|
|
644
640
|
}
|
|
@@ -5,11 +5,10 @@ exports.addNackSuppportForOpus = void 0;
|
|
|
5
5
|
* This function adds RTCP NACK support for OPUS codec in given capabilities.
|
|
6
6
|
*/
|
|
7
7
|
function addNackSuppportForOpus(rtpCapabilities) {
|
|
8
|
-
var _a;
|
|
9
8
|
for (const codec of (rtpCapabilities.codecs || [])) {
|
|
10
9
|
if ((codec.mimeType.toLowerCase() === 'audio/opus' ||
|
|
11
10
|
codec.mimeType.toLowerCase() === 'audio/multiopus') &&
|
|
12
|
-
!
|
|
11
|
+
!codec.rtcpFeedback?.some((fb) => fb.type === 'nack' && !fb.parameter)) {
|
|
13
12
|
if (!codec.rtcpFeedback) {
|
|
14
13
|
codec.rtcpFeedback = [];
|
|
15
14
|
}
|
|
@@ -312,7 +312,6 @@ class AnswerMediaSection extends MediaSection {
|
|
|
312
312
|
this._mediaObject.direction = 'recvonly';
|
|
313
313
|
}
|
|
314
314
|
muxSimulcastStreams(encodings) {
|
|
315
|
-
var _a;
|
|
316
315
|
if (!this._mediaObject.simulcast || !this._mediaObject.simulcast.list1) {
|
|
317
316
|
return;
|
|
318
317
|
}
|
|
@@ -326,7 +325,7 @@ class AnswerMediaSection extends MediaSection {
|
|
|
326
325
|
const simulcastStreams = sdpTransform.parseSimulcastStreamList(raw);
|
|
327
326
|
for (const simulcastStream of simulcastStreams) {
|
|
328
327
|
for (const simulcastFormat of simulcastStream) {
|
|
329
|
-
simulcastFormat.paused = !
|
|
328
|
+
simulcastFormat.paused = !layers[simulcastFormat.scid]?.active;
|
|
330
329
|
}
|
|
331
330
|
}
|
|
332
331
|
this._mediaObject.simulcast.list1 = simulcastStreams.map((simulcastFormats) => simulcastFormats.map((f) => `${f.paused ? '~' : ''}${f.scid}`).join(',')).join(';');
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/lib/tests/test.js
CHANGED
|
@@ -212,7 +212,6 @@ test('transport.produce() without "connect" listener rejects', async () => {
|
|
|
212
212
|
.toThrow(Error);
|
|
213
213
|
}, 500);
|
|
214
214
|
test('transport.produce() succeeds', async () => {
|
|
215
|
-
var _a, _b;
|
|
216
215
|
const audioTrack = new fake_mediastreamtrack_1.FakeMediaStreamTrack({ kind: 'audio' });
|
|
217
216
|
const videoTrack = new fake_mediastreamtrack_1.FakeMediaStreamTrack({ kind: 'video' });
|
|
218
217
|
let audioProducerId;
|
|
@@ -307,12 +306,12 @@ test('transport.produce() succeeds', async () => {
|
|
|
307
306
|
encodings = audioProducer.rtpParameters.encodings;
|
|
308
307
|
expect(Array.isArray(encodings)).toBe(true);
|
|
309
308
|
expect(encodings.length).toBe(1);
|
|
310
|
-
expect(typeof
|
|
309
|
+
expect(typeof encodings?.[0]).toBe('object');
|
|
311
310
|
expect(Object.keys(encodings[0])).toEqual(['ssrc', 'dtx']);
|
|
312
|
-
expect(typeof
|
|
311
|
+
expect(typeof encodings?.[0].ssrc).toBe('number');
|
|
313
312
|
rtcp = audioProducer.rtpParameters.rtcp;
|
|
314
313
|
expect(typeof rtcp).toBe('object');
|
|
315
|
-
expect(typeof
|
|
314
|
+
expect(typeof rtcp?.cname).toBe('string');
|
|
316
315
|
expect(audioProducer.paused).toBe(true);
|
|
317
316
|
expect(audioProducer.maxSpatialLayer).toBe(undefined);
|
|
318
317
|
expect(audioProducer.appData).toEqual({ foo: 'FOO' });
|
|
@@ -401,19 +400,19 @@ test('transport.produce() succeeds', async () => {
|
|
|
401
400
|
encodings = videoProducer.rtpParameters.encodings;
|
|
402
401
|
expect(Array.isArray(encodings)).toBe(true);
|
|
403
402
|
expect(encodings.length).toBe(2);
|
|
404
|
-
expect(typeof
|
|
405
|
-
expect(typeof
|
|
406
|
-
expect(typeof
|
|
403
|
+
expect(typeof encodings?.[0]).toBe('object');
|
|
404
|
+
expect(typeof encodings?.[0].ssrc).toBe('number');
|
|
405
|
+
expect(typeof encodings?.[0].rtx).toBe('object');
|
|
407
406
|
expect(Object.keys(encodings[0].rtx)).toEqual(['ssrc']);
|
|
408
|
-
expect(typeof
|
|
409
|
-
expect(typeof
|
|
410
|
-
expect(typeof
|
|
411
|
-
expect(typeof
|
|
407
|
+
expect(typeof encodings?.[0].rtx?.ssrc).toBe('number');
|
|
408
|
+
expect(typeof encodings?.[1]).toBe('object');
|
|
409
|
+
expect(typeof encodings?.[1].ssrc).toBe('number');
|
|
410
|
+
expect(typeof encodings?.[1].rtx).toBe('object');
|
|
412
411
|
expect(Object.keys(encodings[1].rtx)).toEqual(['ssrc']);
|
|
413
|
-
expect(typeof
|
|
412
|
+
expect(typeof encodings?.[1].rtx?.ssrc).toBe('number');
|
|
414
413
|
rtcp = videoProducer.rtpParameters.rtcp;
|
|
415
414
|
expect(typeof rtcp).toBe('object');
|
|
416
|
-
expect(typeof
|
|
415
|
+
expect(typeof rtcp?.cname).toBe('string');
|
|
417
416
|
expect(videoProducer.paused).toBe(false);
|
|
418
417
|
expect(videoProducer.maxSpatialLayer).toBe(undefined);
|
|
419
418
|
expect(videoProducer.appData).toEqual({});
|
|
@@ -446,7 +445,6 @@ test('transport.produce() with a non object appData rejects with TypeError', asy
|
|
|
446
445
|
.toThrow(TypeError);
|
|
447
446
|
}, 500);
|
|
448
447
|
test('transport.consume() succeeds', async () => {
|
|
449
|
-
var _a;
|
|
450
448
|
const audioConsumerRemoteParameters = fakeParameters.generateConsumerRemoteParameters({ codecMimeType: 'audio/opus' });
|
|
451
449
|
const videoConsumerRemoteParameters = fakeParameters.generateConsumerRemoteParameters({ codecMimeType: 'video/VP8' });
|
|
452
450
|
let connectEventNumTimesCalled = 0;
|
|
@@ -517,12 +515,12 @@ test('transport.consume() succeeds', async () => {
|
|
|
517
515
|
encodings = audioConsumer.rtpParameters.encodings;
|
|
518
516
|
expect(Array.isArray(encodings)).toBe(true);
|
|
519
517
|
expect(encodings.length).toBe(1);
|
|
520
|
-
expect(typeof
|
|
518
|
+
expect(typeof encodings?.[0]).toBe('object');
|
|
521
519
|
expect(Object.keys(encodings[0])).toEqual(['ssrc', 'dtx']);
|
|
522
520
|
expect(typeof encodings[0].ssrc).toBe('number');
|
|
523
521
|
rtcp = audioProducer.rtpParameters.rtcp;
|
|
524
522
|
expect(typeof rtcp).toBe('object');
|
|
525
|
-
expect(typeof
|
|
523
|
+
expect(typeof rtcp?.cname).toBe('string');
|
|
526
524
|
expect(audioConsumer.paused).toBe(false);
|
|
527
525
|
expect(audioConsumer.appData).toEqual({ bar: 'BAR' });
|
|
528
526
|
videoConsumer = await recvTransport.consume({
|
|
@@ -602,15 +600,15 @@ test('transport.consume() succeeds', async () => {
|
|
|
602
600
|
encodings = videoConsumer.rtpParameters.encodings;
|
|
603
601
|
expect(Array.isArray(encodings)).toBe(true);
|
|
604
602
|
expect(encodings.length).toBe(1);
|
|
605
|
-
expect(typeof
|
|
603
|
+
expect(typeof encodings?.[0]).toBe('object');
|
|
606
604
|
expect(Object.keys(encodings[0])).toEqual(['ssrc', 'rtx', 'dtx']);
|
|
607
|
-
expect(typeof
|
|
608
|
-
expect(typeof
|
|
605
|
+
expect(typeof encodings?.[0].ssrc).toBe('number');
|
|
606
|
+
expect(typeof encodings?.[0].rtx).toBe('object');
|
|
609
607
|
expect(Object.keys(encodings[0].rtx)).toEqual(['ssrc']);
|
|
610
|
-
expect(typeof
|
|
608
|
+
expect(typeof encodings?.[0].rtx?.ssrc).toBe('number');
|
|
611
609
|
rtcp = videoConsumer.rtpParameters.rtcp;
|
|
612
610
|
expect(typeof rtcp).toBe('object');
|
|
613
|
-
expect(typeof
|
|
611
|
+
expect(typeof rtcp?.cname).toBe('string');
|
|
614
612
|
expect(videoConsumer.paused).toBe(false);
|
|
615
613
|
expect(videoConsumer.appData).toEqual({});
|
|
616
614
|
recvTransport.removeAllListeners('connect');
|
|
@@ -854,20 +852,17 @@ test('connection state change fires "connectionstatechange" in live Transport',
|
|
|
854
852
|
sendTransport.removeAllListeners('connectionstatechange');
|
|
855
853
|
});
|
|
856
854
|
test('producer.pause() succeeds', () => {
|
|
857
|
-
var _a;
|
|
858
855
|
videoProducer.pause();
|
|
859
856
|
expect(videoProducer.paused).toBe(true);
|
|
860
857
|
// Track will be still enabled due to disableTrackOnPause: false.
|
|
861
|
-
expect(
|
|
858
|
+
expect(videoProducer.track?.enabled).toBe(true);
|
|
862
859
|
});
|
|
863
860
|
test('producer.resume() succeeds', () => {
|
|
864
|
-
var _a;
|
|
865
861
|
videoProducer.resume();
|
|
866
862
|
expect(videoProducer.paused).toBe(false);
|
|
867
|
-
expect(
|
|
863
|
+
expect(videoProducer.track?.enabled).toBe(true);
|
|
868
864
|
});
|
|
869
865
|
test('producer.replaceTrack() with a new track succeeds', async () => {
|
|
870
|
-
var _a;
|
|
871
866
|
// Have the audio Producer paused.
|
|
872
867
|
audioProducer.pause();
|
|
873
868
|
const audioProducerPreviousTrack = audioProducer.track;
|
|
@@ -876,8 +871,8 @@ test('producer.replaceTrack() with a new track succeeds', async () => {
|
|
|
876
871
|
.resolves
|
|
877
872
|
.toBe(undefined);
|
|
878
873
|
// Previous track must be 'live' due to stopTracks: false.
|
|
879
|
-
expect(audioProducerPreviousTrack
|
|
880
|
-
expect(
|
|
874
|
+
expect(audioProducerPreviousTrack?.readyState).toBe('live');
|
|
875
|
+
expect(audioProducer.track?.readyState).toBe('live');
|
|
881
876
|
expect(audioProducer.track).not.toBe(audioProducerPreviousTrack);
|
|
882
877
|
expect(audioProducer.track).toBe(newAudioTrack);
|
|
883
878
|
// Producer was already paused.
|
|
@@ -890,7 +885,7 @@ test('producer.replaceTrack() with a new track succeeds', async () => {
|
|
|
890
885
|
.resolves
|
|
891
886
|
.toBe(undefined);
|
|
892
887
|
// Previous track must be 'ended' due to stopTracks: true.
|
|
893
|
-
expect(videoProducerPreviousTrack
|
|
888
|
+
expect(videoProducerPreviousTrack?.readyState).toBe('ended');
|
|
894
889
|
expect(videoProducer.track).not.toBe(videoProducerPreviousTrack);
|
|
895
890
|
expect(videoProducer.track).toBe(newVideoTrack);
|
|
896
891
|
expect(videoProducer.paused).toBe(false);
|
|
@@ -903,7 +898,7 @@ test('producer.replaceTrack() with null succeeds', async () => {
|
|
|
903
898
|
.resolves
|
|
904
899
|
.toBe(undefined);
|
|
905
900
|
// Previous track must be 'live' due to stopTracks: false.
|
|
906
|
-
expect(audioProducerPreviousTrack
|
|
901
|
+
expect(audioProducerPreviousTrack?.readyState).toBe('live');
|
|
907
902
|
expect(audioProducer.track).toBeNull();
|
|
908
903
|
// Producer was already paused.
|
|
909
904
|
expect(audioProducer.paused).toBe(true);
|
|
@@ -919,26 +914,24 @@ test('producer.replaceTrack() with null succeeds', async () => {
|
|
|
919
914
|
// The given audio track was muted but the Producer was not, so the track
|
|
920
915
|
// must not be muted now.
|
|
921
916
|
expect(audioProducer.paused).toBe(false);
|
|
922
|
-
expect(audioProducerPreviousTrack
|
|
917
|
+
expect(audioProducerPreviousTrack?.enabled).toBe(true);
|
|
923
918
|
// Reset the audio paused state.
|
|
924
919
|
audioProducer.resume();
|
|
925
920
|
}, 500);
|
|
926
921
|
test('producer.replaceTrack() with an ended track rejects with InvalidStateError', async () => {
|
|
927
|
-
var _a;
|
|
928
922
|
const track = new fake_mediastreamtrack_1.FakeMediaStreamTrack({ kind: 'audio' });
|
|
929
923
|
track.stop();
|
|
930
924
|
await expect(videoProducer.replaceTrack({ track }))
|
|
931
925
|
.rejects
|
|
932
926
|
.toThrow(errors_1.InvalidStateError);
|
|
933
927
|
expect(track.readyState).toBe('ended');
|
|
934
|
-
expect(
|
|
928
|
+
expect(videoProducer.track?.readyState).toBe('live');
|
|
935
929
|
}, 500);
|
|
936
930
|
test('producer.replaceTrack() with the same track succeeds', async () => {
|
|
937
|
-
var _a;
|
|
938
931
|
await expect(audioProducer.replaceTrack({ track: audioProducer.track }))
|
|
939
932
|
.resolves
|
|
940
933
|
.toBe(undefined);
|
|
941
|
-
expect(
|
|
934
|
+
expect(audioProducer.track?.readyState).toBe('live');
|
|
942
935
|
}, 500);
|
|
943
936
|
test('producer.setMaxSpatialLayer() succeeds', async () => {
|
|
944
937
|
await expect(videoProducer.setMaxSpatialLayer(0))
|
|
@@ -987,11 +980,10 @@ test('consumer.getStats() succeeds', async () => {
|
|
|
987
980
|
expect(typeof stats).toBe('object');
|
|
988
981
|
}, 500);
|
|
989
982
|
test('producer.close() succeed', () => {
|
|
990
|
-
var _a;
|
|
991
983
|
audioProducer.close();
|
|
992
984
|
expect(audioProducer.closed).toBe(true);
|
|
993
985
|
// Track will be still 'live' due to stopTracks: false.
|
|
994
|
-
expect(
|
|
986
|
+
expect(audioProducer.track?.readyState).toBe('live');
|
|
995
987
|
});
|
|
996
988
|
test('producer.replaceTrack() rejects with InvalidStateError if closed', async () => {
|
|
997
989
|
const audioTrack = new fake_mediastreamtrack_1.FakeMediaStreamTrack({ kind: 'audio' });
|
|
@@ -1160,7 +1152,6 @@ test('connection state change does not fire "connectionstatechange" in closed Tr
|
|
|
1160
1152
|
sendTransport.removeAllListeners('connectionstatechange');
|
|
1161
1153
|
});
|
|
1162
1154
|
test('RemoteSdp properly handles multiple streams of the same type in planB', async () => {
|
|
1163
|
-
var _a, _b, _c;
|
|
1164
1155
|
let sdp = undefined;
|
|
1165
1156
|
let sdpObject = undefined;
|
|
1166
1157
|
const remoteSdp = new RemoteSdp_1.RemoteSdp({ planB: true });
|
|
@@ -1180,7 +1171,7 @@ test('RemoteSdp properly handles multiple streams of the same type in planB', as
|
|
|
1180
1171
|
expect(sdpObject.media[0].rtp[0].codec).toBe('VP8');
|
|
1181
1172
|
expect(sdpObject.media[0].rtp[1].payload).toBe(102);
|
|
1182
1173
|
expect(sdpObject.media[0].rtp[1].codec).toBe('rtx');
|
|
1183
|
-
expect(
|
|
1174
|
+
expect(sdpObject.media[0].ssrcs?.length).toBe(4);
|
|
1184
1175
|
await remoteSdp.receive({
|
|
1185
1176
|
mid: 'video',
|
|
1186
1177
|
kind: 'video',
|
|
@@ -1201,7 +1192,7 @@ test('RemoteSdp properly handles multiple streams of the same type in planB', as
|
|
|
1201
1192
|
expect(sdpObject.media[0].rtp[2].codec).toBe('H264');
|
|
1202
1193
|
expect(sdpObject.media[0].rtp[3].payload).toBe(104);
|
|
1203
1194
|
expect(sdpObject.media[0].rtp[3].codec).toBe('rtx');
|
|
1204
|
-
expect(
|
|
1195
|
+
expect(sdpObject.media[0].ssrcs?.length).toBe(8);
|
|
1205
1196
|
await remoteSdp.planBStopReceiving({
|
|
1206
1197
|
mid: 'video',
|
|
1207
1198
|
offerRtpParameters: fakeParameters.generateConsumerRemoteParameters({ codecMimeType: 'video/H264' }).rtpParameters
|
|
@@ -1219,10 +1210,9 @@ test('RemoteSdp properly handles multiple streams of the same type in planB', as
|
|
|
1219
1210
|
expect(sdpObject.media[0].rtp[2].codec).toBe('H264');
|
|
1220
1211
|
expect(sdpObject.media[0].rtp[3].payload).toBe(104);
|
|
1221
1212
|
expect(sdpObject.media[0].rtp[3].codec).toBe('rtx');
|
|
1222
|
-
expect(
|
|
1213
|
+
expect(sdpObject.media[0].ssrcs?.length).toBe(4);
|
|
1223
1214
|
}, 500);
|
|
1224
1215
|
test('RemoteSdp does not duplicate codec descriptions', async () => {
|
|
1225
|
-
var _a, _b;
|
|
1226
1216
|
let sdp = undefined;
|
|
1227
1217
|
let sdpObject = undefined;
|
|
1228
1218
|
const remoteSdp = new RemoteSdp_1.RemoteSdp({ planB: true });
|
|
@@ -1242,7 +1232,7 @@ test('RemoteSdp does not duplicate codec descriptions', async () => {
|
|
|
1242
1232
|
expect(sdpObject.media[0].rtp[0].codec).toBe('VP8');
|
|
1243
1233
|
expect(sdpObject.media[0].rtp[1].payload).toBe(102);
|
|
1244
1234
|
expect(sdpObject.media[0].rtp[1].codec).toBe('rtx');
|
|
1245
|
-
expect(
|
|
1235
|
+
expect(sdpObject.media[0].ssrcs?.length).toBe(4);
|
|
1246
1236
|
await remoteSdp.receive({
|
|
1247
1237
|
mid: 'video',
|
|
1248
1238
|
kind: 'video',
|
|
@@ -1259,7 +1249,7 @@ test('RemoteSdp does not duplicate codec descriptions', async () => {
|
|
|
1259
1249
|
expect(sdpObject.media[0].rtp[0].codec).toBe('VP8');
|
|
1260
1250
|
expect(sdpObject.media[0].rtp[1].payload).toBe(102);
|
|
1261
1251
|
expect(sdpObject.media[0].rtp[1].codec).toBe('rtx');
|
|
1262
|
-
expect(
|
|
1252
|
+
expect(sdpObject.media[0].ssrcs?.length).toBe(8);
|
|
1263
1253
|
}, 500);
|
|
1264
1254
|
test('parseScalabilityMode() works', () => {
|
|
1265
1255
|
expect(parseScalabilityMode('L1T3')).toEqual({ spatialLayers: 1, temporalLayers: 3 });
|