mediasoup-client 3.6.92 → 3.6.94
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/Transport.js +7 -7
- package/lib/handlers/Chrome111.d.ts +2 -0
- package/lib/handlers/Chrome111.d.ts.map +1 -1
- package/lib/handlers/Chrome111.js +39 -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.d.ts +2 -0
- package/lib/handlers/Chrome74.d.ts.map +1 -1
- package/lib/handlers/Chrome74.js +38 -8
- package/lib/handlers/FakeHandler.d.ts +2 -0
- package/lib/handlers/FakeHandler.d.ts.map +1 -1
- package/lib/handlers/FakeHandler.js +35 -2
- package/lib/handlers/Firefox60.d.ts +2 -0
- package/lib/handlers/Firefox60.d.ts.map +1 -1
- package/lib/handlers/Firefox60.js +34 -0
- package/lib/handlers/ReactNative.js +4 -8
- package/lib/handlers/ReactNativeUnifiedPlan.d.ts +2 -0
- package/lib/handlers/ReactNativeUnifiedPlan.d.ts.map +1 -1
- package/lib/handlers/ReactNativeUnifiedPlan.js +40 -9
- package/lib/handlers/Safari11.js +4 -8
- package/lib/handlers/Safari12.d.ts +2 -0
- package/lib/handlers/Safari12.d.ts.map +1 -1
- package/lib/handlers/Safari12.js +39 -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/lib/types.d.ts +9 -9
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +1 -9
- package/npm-scripts.mjs +1 -2
- package/package.json +9 -9
package/lib/handlers/Chrome74.js
CHANGED
|
@@ -31,6 +31,7 @@ const ortc = __importStar(require("../ortc"));
|
|
|
31
31
|
const sdpCommonUtils = __importStar(require("./sdp/commonUtils"));
|
|
32
32
|
const sdpUnifiedPlanUtils = __importStar(require("./sdp/unifiedPlanUtils"));
|
|
33
33
|
const ortcUtils = __importStar(require("./ortc/utils"));
|
|
34
|
+
const errors_1 = require("../errors");
|
|
34
35
|
const HandlerInterface_1 = require("./HandlerInterface");
|
|
35
36
|
const RemoteSdp_1 = require("./sdp/RemoteSdp");
|
|
36
37
|
const scalabilityModes_1 = require("../scalabilityModes");
|
|
@@ -45,6 +46,8 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
45
46
|
}
|
|
46
47
|
constructor() {
|
|
47
48
|
super();
|
|
49
|
+
// Closed flag.
|
|
50
|
+
this._closed = false;
|
|
48
51
|
// Map of RTCTransceivers indexed by MID.
|
|
49
52
|
this._mapMidTransceiver = new Map();
|
|
50
53
|
// Local stream for sending.
|
|
@@ -61,6 +64,10 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
61
64
|
}
|
|
62
65
|
close() {
|
|
63
66
|
logger.debug('close()');
|
|
67
|
+
if (this._closed) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
this._closed = true;
|
|
64
71
|
// Close RTCPeerConnection.
|
|
65
72
|
if (this._pc) {
|
|
66
73
|
try {
|
|
@@ -169,12 +176,14 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
169
176
|
}
|
|
170
177
|
}
|
|
171
178
|
async updateIceServers(iceServers) {
|
|
179
|
+
this.assertNotClosed();
|
|
172
180
|
logger.debug('updateIceServers()');
|
|
173
181
|
const configuration = this._pc.getConfiguration();
|
|
174
182
|
configuration.iceServers = iceServers;
|
|
175
183
|
this._pc.setConfiguration(configuration);
|
|
176
184
|
}
|
|
177
185
|
async restartIce(iceParameters) {
|
|
186
|
+
this.assertNotClosed();
|
|
178
187
|
logger.debug('restartIce()');
|
|
179
188
|
// Provide the remote SDP handler with new remote ICE parameters.
|
|
180
189
|
this._remoteSdp.updateIceParameters(iceParameters);
|
|
@@ -199,10 +208,11 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
199
208
|
}
|
|
200
209
|
}
|
|
201
210
|
async getTransportStats() {
|
|
211
|
+
this.assertNotClosed();
|
|
202
212
|
return this._pc.getStats();
|
|
203
213
|
}
|
|
204
214
|
async send({ track, encodings, codecOptions, codec }) {
|
|
205
|
-
|
|
215
|
+
this.assertNotClosed();
|
|
206
216
|
this.assertSendDirection();
|
|
207
217
|
logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
|
|
208
218
|
if (encodings && encodings.length > 1) {
|
|
@@ -229,7 +239,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
229
239
|
let offerMediaObject;
|
|
230
240
|
if (!this._transportReady) {
|
|
231
241
|
await this.setupTransport({
|
|
232
|
-
localDtlsRole:
|
|
242
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
233
243
|
localSdpObject
|
|
234
244
|
});
|
|
235
245
|
}
|
|
@@ -317,6 +327,9 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
317
327
|
async stopSending(localId) {
|
|
318
328
|
this.assertSendDirection();
|
|
319
329
|
logger.debug('stopSending() [localId:%s]', localId);
|
|
330
|
+
if (this._closed) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
320
333
|
const transceiver = this._mapMidTransceiver.get(localId);
|
|
321
334
|
if (!transceiver) {
|
|
322
335
|
throw new Error('associated RTCRtpTransceiver not found');
|
|
@@ -339,6 +352,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
339
352
|
this._mapMidTransceiver.delete(localId);
|
|
340
353
|
}
|
|
341
354
|
async pauseSending(localId) {
|
|
355
|
+
this.assertNotClosed();
|
|
342
356
|
this.assertSendDirection();
|
|
343
357
|
logger.debug('pauseSending() [localId:%s]', localId);
|
|
344
358
|
const transceiver = this._mapMidTransceiver.get(localId);
|
|
@@ -355,6 +369,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
355
369
|
await this._pc.setRemoteDescription(answer);
|
|
356
370
|
}
|
|
357
371
|
async resumeSending(localId) {
|
|
372
|
+
this.assertNotClosed();
|
|
358
373
|
this.assertSendDirection();
|
|
359
374
|
logger.debug('resumeSending() [localId:%s]', localId);
|
|
360
375
|
const transceiver = this._mapMidTransceiver.get(localId);
|
|
@@ -371,6 +386,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
371
386
|
await this._pc.setRemoteDescription(answer);
|
|
372
387
|
}
|
|
373
388
|
async replaceTrack(localId, track) {
|
|
389
|
+
this.assertNotClosed();
|
|
374
390
|
this.assertSendDirection();
|
|
375
391
|
if (track) {
|
|
376
392
|
logger.debug('replaceTrack() [localId:%s, track.id:%s]', localId, track.id);
|
|
@@ -385,6 +401,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
385
401
|
await transceiver.sender.replaceTrack(track);
|
|
386
402
|
}
|
|
387
403
|
async setMaxSpatialLayer(localId, spatialLayer) {
|
|
404
|
+
this.assertNotClosed();
|
|
388
405
|
this.assertSendDirection();
|
|
389
406
|
logger.debug('setMaxSpatialLayer() [localId:%s, spatialLayer:%s]', localId, spatialLayer);
|
|
390
407
|
const transceiver = this._mapMidTransceiver.get(localId);
|
|
@@ -410,6 +427,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
410
427
|
await this._pc.setRemoteDescription(answer);
|
|
411
428
|
}
|
|
412
429
|
async setRtpEncodingParameters(localId, params) {
|
|
430
|
+
this.assertNotClosed();
|
|
413
431
|
this.assertSendDirection();
|
|
414
432
|
logger.debug('setRtpEncodingParameters() [localId:%s, params:%o]', localId, params);
|
|
415
433
|
const transceiver = this._mapMidTransceiver.get(localId);
|
|
@@ -430,6 +448,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
430
448
|
await this._pc.setRemoteDescription(answer);
|
|
431
449
|
}
|
|
432
450
|
async getSenderStats(localId) {
|
|
451
|
+
this.assertNotClosed();
|
|
433
452
|
this.assertSendDirection();
|
|
434
453
|
const transceiver = this._mapMidTransceiver.get(localId);
|
|
435
454
|
if (!transceiver) {
|
|
@@ -438,7 +457,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
438
457
|
return transceiver.sender.getStats();
|
|
439
458
|
}
|
|
440
459
|
async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
|
|
441
|
-
|
|
460
|
+
this.assertNotClosed();
|
|
442
461
|
this.assertSendDirection();
|
|
443
462
|
const options = {
|
|
444
463
|
negotiated: true,
|
|
@@ -462,7 +481,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
462
481
|
.find((m) => m.type === 'application');
|
|
463
482
|
if (!this._transportReady) {
|
|
464
483
|
await this.setupTransport({
|
|
465
|
-
localDtlsRole:
|
|
484
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
466
485
|
localSdpObject
|
|
467
486
|
});
|
|
468
487
|
}
|
|
@@ -483,7 +502,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
483
502
|
return { dataChannel, sctpStreamParameters };
|
|
484
503
|
}
|
|
485
504
|
async receive(optionsList) {
|
|
486
|
-
|
|
505
|
+
this.assertNotClosed();
|
|
487
506
|
this.assertRecvDirection();
|
|
488
507
|
const results = [];
|
|
489
508
|
const mapLocalId = new Map();
|
|
@@ -520,7 +539,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
520
539
|
answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
|
|
521
540
|
if (!this._transportReady) {
|
|
522
541
|
await this.setupTransport({
|
|
523
|
-
localDtlsRole:
|
|
542
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
524
543
|
localSdpObject
|
|
525
544
|
});
|
|
526
545
|
}
|
|
@@ -548,6 +567,9 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
548
567
|
}
|
|
549
568
|
async stopReceiving(localIds) {
|
|
550
569
|
this.assertRecvDirection();
|
|
570
|
+
if (this._closed) {
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
551
573
|
for (const localId of localIds) {
|
|
552
574
|
logger.debug('stopReceiving() [localId:%s]', localId);
|
|
553
575
|
const transceiver = this._mapMidTransceiver.get(localId);
|
|
@@ -567,6 +589,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
567
589
|
}
|
|
568
590
|
}
|
|
569
591
|
async pauseReceiving(localIds) {
|
|
592
|
+
this.assertNotClosed();
|
|
570
593
|
this.assertRecvDirection();
|
|
571
594
|
for (const localId of localIds) {
|
|
572
595
|
logger.debug('pauseReceiving() [localId:%s]', localId);
|
|
@@ -585,6 +608,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
585
608
|
await this._pc.setLocalDescription(answer);
|
|
586
609
|
}
|
|
587
610
|
async resumeReceiving(localIds) {
|
|
611
|
+
this.assertNotClosed();
|
|
588
612
|
this.assertRecvDirection();
|
|
589
613
|
for (const localId of localIds) {
|
|
590
614
|
logger.debug('resumeReceiving() [localId:%s]', localId);
|
|
@@ -603,6 +627,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
603
627
|
await this._pc.setLocalDescription(answer);
|
|
604
628
|
}
|
|
605
629
|
async getReceiverStats(localId) {
|
|
630
|
+
this.assertNotClosed();
|
|
606
631
|
this.assertRecvDirection();
|
|
607
632
|
const transceiver = this._mapMidTransceiver.get(localId);
|
|
608
633
|
if (!transceiver) {
|
|
@@ -611,7 +636,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
611
636
|
return transceiver.receiver.getStats();
|
|
612
637
|
}
|
|
613
638
|
async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
|
|
614
|
-
|
|
639
|
+
this.assertNotClosed();
|
|
615
640
|
this.assertRecvDirection();
|
|
616
641
|
const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
|
|
617
642
|
const options = {
|
|
@@ -635,7 +660,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
635
660
|
if (!this._transportReady) {
|
|
636
661
|
const localSdpObject = sdpTransform.parse(answer.sdp);
|
|
637
662
|
await this.setupTransport({
|
|
638
|
-
localDtlsRole:
|
|
663
|
+
localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
|
|
639
664
|
localSdpObject
|
|
640
665
|
});
|
|
641
666
|
}
|
|
@@ -661,6 +686,11 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
|
|
|
661
686
|
});
|
|
662
687
|
this._transportReady = true;
|
|
663
688
|
}
|
|
689
|
+
assertNotClosed() {
|
|
690
|
+
if (this._closed) {
|
|
691
|
+
throw new errors_1.InvalidStateError('method called in a closed handler');
|
|
692
|
+
}
|
|
693
|
+
}
|
|
664
694
|
assertSendDirection() {
|
|
665
695
|
if (this._direction !== 'send') {
|
|
666
696
|
throw new Error('method can just be called for handlers with "send" direction');
|
|
@@ -8,6 +8,7 @@ export type FakeParameters = {
|
|
|
8
8
|
generateLocalDtlsParameters: () => DtlsParameters;
|
|
9
9
|
};
|
|
10
10
|
export declare class FakeHandler extends HandlerInterface {
|
|
11
|
+
private _closed;
|
|
11
12
|
private fakeParameters;
|
|
12
13
|
private _rtpParametersByKind?;
|
|
13
14
|
private _cname;
|
|
@@ -45,5 +46,6 @@ export declare class FakeHandler extends HandlerInterface {
|
|
|
45
46
|
getReceiverStats(localId: string): Promise<RTCStatsReport>;
|
|
46
47
|
receiveDataChannel({ sctpStreamParameters, label, protocol }: HandlerReceiveDataChannelOptions): Promise<HandlerReceiveDataChannelResult>;
|
|
47
48
|
private setupTransport;
|
|
49
|
+
private assertNotClosed;
|
|
48
50
|
}
|
|
49
51
|
//# sourceMappingURL=FakeHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FakeHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/FakeHand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AC,oBAAoB,EAAE,CAAC;IA4B7B,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAehD,cAAc,CAEnB,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAO7B,eAAe,CAEpB,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ7B,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAO1D,kBAAkB,CACvB,EAAE,oBAAoB,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,gCAAgC,GACzE,OAAO,CAAC,+BAA+B,CAAC;YAyB7B,cAAc;IAgC5B,OAAO,CAAC,eAAe;CAOvB"}
|
|
@@ -29,6 +29,7 @@ const Logger_1 = require("../Logger");
|
|
|
29
29
|
const fake_mediastreamtrack_1 = require("fake-mediastreamtrack");
|
|
30
30
|
const utils = __importStar(require("../utils"));
|
|
31
31
|
const ortc = __importStar(require("../ortc"));
|
|
32
|
+
const errors_1 = require("../errors");
|
|
32
33
|
const HandlerInterface_1 = require("./HandlerInterface");
|
|
33
34
|
const logger = new Logger_1.Logger('FakeHandler');
|
|
34
35
|
class FakeDataChannel extends EnhancedEventEmitter_1.EnhancedEventEmitter {
|
|
@@ -61,6 +62,8 @@ class FakeHandler extends HandlerInterface_1.HandlerInterface {
|
|
|
61
62
|
}
|
|
62
63
|
constructor(fakeParameters) {
|
|
63
64
|
super();
|
|
65
|
+
// Closed flag.
|
|
66
|
+
this._closed = false;
|
|
64
67
|
// Local RTCP CNAME.
|
|
65
68
|
this._cname = `CNAME-${utils.generateRandomNumber()}`;
|
|
66
69
|
// Got transport local and remote parameters.
|
|
@@ -78,6 +81,10 @@ class FakeHandler extends HandlerInterface_1.HandlerInterface {
|
|
|
78
81
|
}
|
|
79
82
|
close() {
|
|
80
83
|
logger.debug('close()');
|
|
84
|
+
if (this._closed) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
this._closed = true;
|
|
81
88
|
}
|
|
82
89
|
// NOTE: Custom method for simulation purposes.
|
|
83
90
|
setConnectionState(connectionState) {
|
|
@@ -96,6 +103,7 @@ class FakeHandler extends HandlerInterface_1.HandlerInterface {
|
|
|
96
103
|
direction, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, proprietaryConstraints, extendedRtpCapabilities
|
|
97
104
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
98
105
|
}) {
|
|
106
|
+
this.assertNotClosed();
|
|
99
107
|
logger.debug('run()');
|
|
100
108
|
// Generic sending RTP parameters for audio and video.
|
|
101
109
|
// @type {Object}
|
|
@@ -107,20 +115,22 @@ class FakeHandler extends HandlerInterface_1.HandlerInterface {
|
|
|
107
115
|
}
|
|
108
116
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
109
117
|
async updateIceServers(iceServers) {
|
|
118
|
+
this.assertNotClosed();
|
|
110
119
|
logger.debug('updateIceServers()');
|
|
111
|
-
return;
|
|
112
120
|
}
|
|
113
121
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
114
122
|
async restartIce(iceParameters) {
|
|
123
|
+
this.assertNotClosed();
|
|
115
124
|
logger.debug('restartIce()');
|
|
116
|
-
return;
|
|
117
125
|
}
|
|
118
126
|
async getTransportStats() {
|
|
127
|
+
this.assertNotClosed();
|
|
119
128
|
return new Map(); // NOTE: Whatever.
|
|
120
129
|
}
|
|
121
130
|
async send(
|
|
122
131
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
123
132
|
{ track, encodings, codecOptions, codec }) {
|
|
133
|
+
this.assertNotClosed();
|
|
124
134
|
logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
|
|
125
135
|
if (!this._transportReady) {
|
|
126
136
|
await this.setupTransport({ localDtlsRole: 'server' });
|
|
@@ -152,6 +162,9 @@ class FakeHandler extends HandlerInterface_1.HandlerInterface {
|
|
|
152
162
|
}
|
|
153
163
|
async stopSending(localId) {
|
|
154
164
|
logger.debug('stopSending() [localId:%s]', localId);
|
|
165
|
+
if (this._closed) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
155
168
|
if (!this._tracks.has(Number(localId))) {
|
|
156
169
|
throw new Error('local track not found');
|
|
157
170
|
}
|
|
@@ -159,13 +172,16 @@ class FakeHandler extends HandlerInterface_1.HandlerInterface {
|
|
|
159
172
|
}
|
|
160
173
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
161
174
|
async pauseSending(localId) {
|
|
175
|
+
this.assertNotClosed();
|
|
162
176
|
// Unimplemented.
|
|
163
177
|
}
|
|
164
178
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
165
179
|
async resumeSending(localId) {
|
|
180
|
+
this.assertNotClosed();
|
|
166
181
|
// Unimplemented.
|
|
167
182
|
}
|
|
168
183
|
async replaceTrack(localId, track) {
|
|
184
|
+
this.assertNotClosed();
|
|
169
185
|
if (track) {
|
|
170
186
|
logger.debug('replaceTrack() [localId:%s, track.id:%s]', localId, track.id);
|
|
171
187
|
}
|
|
@@ -176,16 +192,20 @@ class FakeHandler extends HandlerInterface_1.HandlerInterface {
|
|
|
176
192
|
this._tracks.set(Number(localId), track);
|
|
177
193
|
}
|
|
178
194
|
async setMaxSpatialLayer(localId, spatialLayer) {
|
|
195
|
+
this.assertNotClosed();
|
|
179
196
|
logger.debug('setMaxSpatialLayer() [localId:%s, spatialLayer:%s]', localId, spatialLayer);
|
|
180
197
|
}
|
|
181
198
|
async setRtpEncodingParameters(localId, params) {
|
|
199
|
+
this.assertNotClosed();
|
|
182
200
|
logger.debug('setRtpEncodingParameters() [localId:%s, params:%o]', localId, params);
|
|
183
201
|
}
|
|
184
202
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
185
203
|
async getSenderStats(localId) {
|
|
204
|
+
this.assertNotClosed();
|
|
186
205
|
return new Map(); // NOTE: Whatever.
|
|
187
206
|
}
|
|
188
207
|
async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
|
|
208
|
+
this.assertNotClosed();
|
|
189
209
|
if (!this._transportReady) {
|
|
190
210
|
await this.setupTransport({ localDtlsRole: 'server' });
|
|
191
211
|
}
|
|
@@ -208,6 +228,7 @@ class FakeHandler extends HandlerInterface_1.HandlerInterface {
|
|
|
208
228
|
return { dataChannel, sctpStreamParameters };
|
|
209
229
|
}
|
|
210
230
|
async receive(optionsList) {
|
|
231
|
+
this.assertNotClosed();
|
|
211
232
|
const results = [];
|
|
212
233
|
for (const options of optionsList) {
|
|
213
234
|
const { trackId, kind } = options;
|
|
@@ -223,6 +244,9 @@ class FakeHandler extends HandlerInterface_1.HandlerInterface {
|
|
|
223
244
|
return results;
|
|
224
245
|
}
|
|
225
246
|
async stopReceiving(localIds) {
|
|
247
|
+
if (this._closed) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
226
250
|
for (const localId of localIds) {
|
|
227
251
|
logger.debug('stopReceiving() [localId:%s]', localId);
|
|
228
252
|
this._tracks.delete(Number(localId));
|
|
@@ -231,18 +255,22 @@ class FakeHandler extends HandlerInterface_1.HandlerInterface {
|
|
|
231
255
|
async pauseReceiving(
|
|
232
256
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
233
257
|
localIds) {
|
|
258
|
+
this.assertNotClosed();
|
|
234
259
|
// Unimplemented.
|
|
235
260
|
}
|
|
236
261
|
async resumeReceiving(
|
|
237
262
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
238
263
|
localIds) {
|
|
264
|
+
this.assertNotClosed();
|
|
239
265
|
// Unimplemented.
|
|
240
266
|
}
|
|
241
267
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
242
268
|
async getReceiverStats(localId) {
|
|
269
|
+
this.assertNotClosed();
|
|
243
270
|
return new Map(); //
|
|
244
271
|
}
|
|
245
272
|
async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
|
|
273
|
+
this.assertNotClosed();
|
|
246
274
|
if (!this._transportReady) {
|
|
247
275
|
await this.setupTransport({ localDtlsRole: 'client' });
|
|
248
276
|
}
|
|
@@ -272,5 +300,10 @@ class FakeHandler extends HandlerInterface_1.HandlerInterface {
|
|
|
272
300
|
await new Promise((resolve, reject) => (this.emit('@connect', { dtlsParameters }, resolve, reject)));
|
|
273
301
|
this._transportReady = true;
|
|
274
302
|
}
|
|
303
|
+
assertNotClosed() {
|
|
304
|
+
if (this._closed) {
|
|
305
|
+
throw new errors_1.InvalidStateError('method called in a closed handler');
|
|
306
|
+
}
|
|
307
|
+
}
|
|
275
308
|
}
|
|
276
309
|
exports.FakeHandler = FakeHandler;
|
|
@@ -3,6 +3,7 @@ import { IceParameters } from '../Transport';
|
|
|
3
3
|
import { RtpCapabilities } from '../RtpParameters';
|
|
4
4
|
import { SctpCapabilities } from '../SctpParameters';
|
|
5
5
|
export declare class Firefox60 extends HandlerInterface {
|
|
6
|
+
private _closed;
|
|
6
7
|
private _direction?;
|
|
7
8
|
private _remoteSdp?;
|
|
8
9
|
private _sendingRtpParametersByKind?;
|
|
@@ -42,6 +43,7 @@ export declare class Firefox60 extends HandlerInterface {
|
|
|
42
43
|
getReceiverStats(localId: string): Promise<RTCStatsReport>;
|
|
43
44
|
receiveDataChannel({ sctpStreamParameters, label, protocol }: HandlerReceiveDataChannelOptions): Promise<HandlerReceiveDataChannelResult>;
|
|
44
45
|
private setupTransport;
|
|
46
|
+
private assertNotClosed;
|
|
45
47
|
private assertSendDirection;
|
|
46
48
|
private assertRecvDirection;
|
|
47
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Firefox60.d.ts","sourceRoot":"","sources":["../../src/handlers/Firefox60.ts"],"names":[],"mappings":"AAOA,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,6BAA6B,EAC7B,4BAA4B,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46
46
|
constructor() {
|
|
47
47
|
super();
|
|
48
|
+
// Closed flag.
|
|
49
|
+
this._closed = false;
|
|
48
50
|
// Map of RTCTransceivers indexed by MID.
|
|
49
51
|
this._mapMidTransceiver = new Map();
|
|
50
52
|
// Local stream for sending.
|
|
@@ -61,6 +63,10 @@ class Firefox60 extends HandlerInterface_1.HandlerInterface {
|
|
|
61
63
|
}
|
|
62
64
|
close() {
|
|
63
65
|
logger.debug('close()');
|
|
66
|
+
if (this._closed) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
this._closed = true;
|
|
64
70
|
// Close RTCPeerConnection.
|
|
65
71
|
if (this._pc) {
|
|
66
72
|
try {
|
|
@@ -134,6 +140,7 @@ class Firefox60 extends HandlerInterface_1.HandlerInterface {
|
|
|
134
140
|
};
|
|
135
141
|
}
|
|
136
142
|
run({ direction, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, extendedRtpCapabilities }) {
|
|
143
|
+
this.assertNotClosed();
|
|
137
144
|
logger.debug('run()');
|
|
138
145
|
this._direction = direction;
|
|
139
146
|
this._remoteSdp = new RemoteSdp_1.RemoteSdp({
|
|
@@ -190,10 +197,12 @@ class Firefox60 extends HandlerInterface_1.HandlerInterface {
|
|
|
190
197
|
}
|
|
191
198
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
192
199
|
async updateIceServers(iceServers) {
|
|
200
|
+
this.assertNotClosed();
|
|
193
201
|
// NOTE: Firefox does not implement pc.setConfiguration().
|
|
194
202
|
throw new errors_1.UnsupportedError('not supported');
|
|
195
203
|
}
|
|
196
204
|
async restartIce(iceParameters) {
|
|
205
|
+
this.assertNotClosed();
|
|
197
206
|
logger.debug('restartIce()');
|
|
198
207
|
// Provide the remote SDP handler with new remote ICE parameters.
|
|
199
208
|
this._remoteSdp.updateIceParameters(iceParameters);
|
|
@@ -218,9 +227,11 @@ class Firefox60 extends HandlerInterface_1.HandlerInterface {
|
|
|
218
227
|
}
|
|
219
228
|
}
|
|
220
229
|
async getTransportStats() {
|
|
230
|
+
this.assertNotClosed();
|
|
221
231
|
return this._pc.getStats();
|
|
222
232
|
}
|
|
223
233
|
async send({ track, encodings, codecOptions, codec }) {
|
|
234
|
+
this.assertNotClosed();
|
|
224
235
|
this.assertSendDirection();
|
|
225
236
|
logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
|
|
226
237
|
if (encodings) {
|
|
@@ -324,7 +335,11 @@ class Firefox60 extends HandlerInterface_1.HandlerInterface {
|
|
|
324
335
|
};
|
|
325
336
|
}
|
|
326
337
|
async stopSending(localId) {
|
|
338
|
+
this.assertSendDirection();
|
|
327
339
|
logger.debug('stopSending() [localId:%s]', localId);
|
|
340
|
+
if (this._closed) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
328
343
|
const transceiver = this._mapMidTransceiver.get(localId);
|
|
329
344
|
if (!transceiver) {
|
|
330
345
|
throw new Error('associated transceiver not found');
|
|
@@ -353,6 +368,7 @@ class Firefox60 extends HandlerInterface_1.HandlerInterface {
|
|
|
353
368
|
}
|
|
354
369
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
355
370
|
async pauseSending(localId) {
|
|
371
|
+
this.assertNotClosed();
|
|
356
372
|
this.assertSendDirection();
|
|
357
373
|
logger.debug('pauseSending() [localId:%s]', localId);
|
|
358
374
|
const transceiver = this._mapMidTransceiver.get(localId);
|
|
@@ -370,6 +386,7 @@ class Firefox60 extends HandlerInterface_1.HandlerInterface {
|
|
|
370
386
|
}
|
|
371
387
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
372
388
|
async resumeSending(localId) {
|
|
389
|
+
this.assertNotClosed();
|
|
373
390
|
this.assertSendDirection();
|
|
374
391
|
logger.debug('resumeSending() [localId:%s]', localId);
|
|
375
392
|
const transceiver = this._mapMidTransceiver.get(localId);
|
|
@@ -386,6 +403,7 @@ class Firefox60 extends HandlerInterface_1.HandlerInterface {
|
|
|
386
403
|
await this._pc.setRemoteDescription(answer);
|
|
387
404
|
}
|
|
388
405
|
async replaceTrack(localId, track) {
|
|
406
|
+
this.assertNotClosed();
|
|
389
407
|
this.assertSendDirection();
|
|
390
408
|
if (track) {
|
|
391
409
|
logger.debug('replaceTrack() [localId:%s, track.id:%s]', localId, track.id);
|
|
@@ -400,6 +418,7 @@ class Firefox60 extends HandlerInterface_1.HandlerInterface {
|
|
|
400
418
|
await transceiver.sender.replaceTrack(track);
|
|
401
419
|
}
|
|
402
420
|
async setMaxSpatialLayer(localId, spatialLayer) {
|
|
421
|
+
this.assertNotClosed();
|
|
403
422
|
this.assertSendDirection();
|
|
404
423
|
logger.debug('setMaxSpatialLayer() [localId:%s, spatialLayer:%s]', localId, spatialLayer);
|
|
405
424
|
const transceiver = this._mapMidTransceiver.get(localId);
|
|
@@ -428,6 +447,7 @@ class Firefox60 extends HandlerInterface_1.HandlerInterface {
|
|
|
428
447
|
await this._pc.setRemoteDescription(answer);
|
|
429
448
|
}
|
|
430
449
|
async setRtpEncodingParameters(localId, params) {
|
|
450
|
+
this.assertNotClosed();
|
|
431
451
|
this.assertSendDirection();
|
|
432
452
|
logger.debug('setRtpEncodingParameters() [localId:%s, params:%o]', localId, params);
|
|
433
453
|
const transceiver = this._mapMidTransceiver.get(localId);
|
|
@@ -448,6 +468,7 @@ class Firefox60 extends HandlerInterface_1.HandlerInterface {
|
|
|
448
468
|
await this._pc.setRemoteDescription(answer);
|
|
449
469
|
}
|
|
450
470
|
async getSenderStats(localId) {
|
|
471
|
+
this.assertNotClosed();
|
|
451
472
|
this.assertSendDirection();
|
|
452
473
|
const transceiver = this._mapMidTransceiver.get(localId);
|
|
453
474
|
if (!transceiver) {
|
|
@@ -456,6 +477,7 @@ class Firefox60 extends HandlerInterface_1.HandlerInterface {
|
|
|
456
477
|
return transceiver.sender.getStats();
|
|
457
478
|
}
|
|
458
479
|
async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
|
|
480
|
+
this.assertNotClosed();
|
|
459
481
|
this.assertSendDirection();
|
|
460
482
|
const options = {
|
|
461
483
|
negotiated: true,
|
|
@@ -499,6 +521,7 @@ class Firefox60 extends HandlerInterface_1.HandlerInterface {
|
|
|
499
521
|
async receive(
|
|
500
522
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
501
523
|
optionsList) {
|
|
524
|
+
this.assertNotClosed();
|
|
502
525
|
this.assertRecvDirection();
|
|
503
526
|
const results = [];
|
|
504
527
|
const mapLocalId = new Map();
|
|
@@ -558,6 +581,9 @@ class Firefox60 extends HandlerInterface_1.HandlerInterface {
|
|
|
558
581
|
}
|
|
559
582
|
async stopReceiving(localIds) {
|
|
560
583
|
this.assertRecvDirection();
|
|
584
|
+
if (this._closed) {
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
561
587
|
for (const localId of localIds) {
|
|
562
588
|
logger.debug('stopReceiving() [localId:%s]', localId);
|
|
563
589
|
const transceiver = this._mapMidTransceiver.get(localId);
|
|
@@ -577,6 +603,7 @@ class Firefox60 extends HandlerInterface_1.HandlerInterface {
|
|
|
577
603
|
}
|
|
578
604
|
}
|
|
579
605
|
async pauseReceiving(localIds) {
|
|
606
|
+
this.assertNotClosed();
|
|
580
607
|
this.assertRecvDirection();
|
|
581
608
|
for (const localId of localIds) {
|
|
582
609
|
logger.debug('pauseReceiving() [localId:%s]', localId);
|
|
@@ -595,6 +622,7 @@ class Firefox60 extends HandlerInterface_1.HandlerInterface {
|
|
|
595
622
|
await this._pc.setLocalDescription(answer);
|
|
596
623
|
}
|
|
597
624
|
async resumeReceiving(localIds) {
|
|
625
|
+
this.assertNotClosed();
|
|
598
626
|
this.assertRecvDirection();
|
|
599
627
|
for (const localId of localIds) {
|
|
600
628
|
logger.debug('resumeReceiving() [localId:%s]', localId);
|
|
@@ -621,6 +649,7 @@ class Firefox60 extends HandlerInterface_1.HandlerInterface {
|
|
|
621
649
|
return transceiver.receiver.getStats();
|
|
622
650
|
}
|
|
623
651
|
async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
|
|
652
|
+
this.assertNotClosed();
|
|
624
653
|
this.assertRecvDirection();
|
|
625
654
|
const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
|
|
626
655
|
const options = {
|
|
@@ -667,6 +696,11 @@ class Firefox60 extends HandlerInterface_1.HandlerInterface {
|
|
|
667
696
|
});
|
|
668
697
|
this._transportReady = true;
|
|
669
698
|
}
|
|
699
|
+
assertNotClosed() {
|
|
700
|
+
if (this._closed) {
|
|
701
|
+
throw new errors_1.InvalidStateError('method called in a closed handler');
|
|
702
|
+
}
|
|
703
|
+
}
|
|
670
704
|
assertSendDirection() {
|
|
671
705
|
if (this._direction !== 'send') {
|
|
672
706
|
throw new Error('method can just be called for handlers with "send" direction');
|
|
@@ -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
|
}
|