mediasoup-client 3.13.0 → 3.14.0
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/DataConsumer.d.ts.map +1 -1
- package/lib/DataConsumer.js +5 -8
- package/lib/DataProducer.d.ts.map +1 -1
- package/lib/DataProducer.js +5 -7
- package/lib/Device.d.ts +2 -2
- package/lib/Device.d.ts.map +1 -1
- package/lib/Device.js +53 -70
- package/lib/RtpParameters.d.ts +8 -8
- package/lib/RtpParameters.d.ts.map +1 -1
- package/lib/Transport.d.ts +4 -4
- package/lib/Transport.d.ts.map +1 -1
- package/lib/Transport.js +6 -7
- package/lib/enhancedEvents.d.ts.map +1 -1
- package/lib/enhancedEvents.js +1 -0
- package/lib/handlers/Chrome111.d.ts +7 -12
- package/lib/handlers/Chrome111.d.ts.map +1 -1
- package/lib/handlers/Chrome111.js +130 -89
- package/lib/handlers/Chrome74.d.ts +7 -12
- package/lib/handlers/Chrome74.d.ts.map +1 -1
- package/lib/handlers/Chrome74.js +130 -85
- package/lib/handlers/FakeHandler.d.ts +6 -9
- package/lib/handlers/FakeHandler.d.ts.map +1 -1
- package/lib/handlers/FakeHandler.js +201 -60
- package/lib/handlers/Firefox120.d.ts +7 -12
- package/lib/handlers/Firefox120.d.ts.map +1 -1
- package/lib/handlers/Firefox120.js +154 -111
- package/lib/handlers/HandlerInterface.d.ts +11 -9
- package/lib/handlers/HandlerInterface.d.ts.map +1 -1
- package/lib/handlers/ReactNative106.d.ts +7 -12
- package/lib/handlers/ReactNative106.d.ts.map +1 -1
- package/lib/handlers/ReactNative106.js +136 -92
- package/lib/handlers/Safari12.d.ts +7 -12
- package/lib/handlers/Safari12.d.ts.map +1 -1
- package/lib/handlers/Safari12.js +132 -86
- package/lib/handlers/sdp/MediaSection.d.ts +5 -5
- package/lib/handlers/sdp/MediaSection.d.ts.map +1 -1
- package/lib/handlers/sdp/MediaSection.js +43 -45
- package/lib/handlers/sdp/RemoteSdp.d.ts +5 -6
- package/lib/handlers/sdp/RemoteSdp.d.ts.map +1 -1
- package/lib/handlers/sdp/RemoteSdp.js +5 -8
- package/lib/handlers/sdp/commonUtils.d.ts +5 -4
- package/lib/handlers/sdp/commonUtils.d.ts.map +1 -1
- package/lib/handlers/sdp/commonUtils.js +2 -2
- package/lib/handlers/sdp/plainRtpUtils.d.ts +4 -3
- package/lib/handlers/sdp/plainRtpUtils.d.ts.map +1 -1
- package/lib/handlers/sdp/plainRtpUtils.js +2 -2
- package/lib/handlers/sdp/unifiedPlanUtils.d.ts +3 -2
- package/lib/handlers/sdp/unifiedPlanUtils.d.ts.map +1 -1
- package/lib/handlers/sdp/unifiedPlanUtils.js +10 -8
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/ortc.d.ts +7 -6
- package/lib/ortc.d.ts.map +1 -1
- package/lib/ortc.js +13 -14
- package/lib/privateTypes.d.ts +27 -0
- package/lib/privateTypes.d.ts.map +1 -0
- package/lib/privateTypes.js +2 -0
- package/lib/test/test.js +18 -1
- package/lib/utils.d.ts +1 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +5 -4
- package/package.json +1 -2
|
@@ -37,7 +37,7 @@ class RemoteSdp {
|
|
|
37
37
|
address: '0.0.0.0',
|
|
38
38
|
ipVer: 4,
|
|
39
39
|
netType: 'IN',
|
|
40
|
-
sessionId: 10000,
|
|
40
|
+
sessionId: '10000',
|
|
41
41
|
sessionVersion: 0,
|
|
42
42
|
username: 'mediasoup-client',
|
|
43
43
|
},
|
|
@@ -113,11 +113,9 @@ class RemoteSdp {
|
|
|
113
113
|
const mediaObject = mediaSection.getObject();
|
|
114
114
|
// Remove Dependency Descriptor extension unless there is support for
|
|
115
115
|
// the codec in mediasoup.
|
|
116
|
-
|
|
117
|
-
const ddCodec = mediaObject.rtp.find((rtp) => DD_CODECS.includes(rtp.codec.toLowerCase()));
|
|
116
|
+
const ddCodec = mediaObject.rtp.find(rtp => DD_CODECS.includes(rtp.codec.toLowerCase()));
|
|
118
117
|
if (!ddCodec) {
|
|
119
|
-
|
|
120
|
-
mediaObject.ext = mediaObject.ext.filter((extmap) => extmap.uri !==
|
|
118
|
+
mediaObject.ext = mediaObject.ext?.filter(extmap => extmap.uri !==
|
|
121
119
|
'https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension');
|
|
122
120
|
}
|
|
123
121
|
// Unified-Plan with closed media section replacement.
|
|
@@ -200,7 +198,7 @@ class RemoteSdp {
|
|
|
200
198
|
mediaSection.muxSimulcastStreams(encodings);
|
|
201
199
|
this._replaceMediaSection(mediaSection);
|
|
202
200
|
}
|
|
203
|
-
sendSctpAssociation({ offerMediaObject }) {
|
|
201
|
+
sendSctpAssociation({ offerMediaObject, }) {
|
|
204
202
|
const mediaSection = new MediaSection_1.AnswerMediaSection({
|
|
205
203
|
iceParameters: this._iceParameters,
|
|
206
204
|
iceCandidates: this._iceCandidates,
|
|
@@ -211,7 +209,7 @@ class RemoteSdp {
|
|
|
211
209
|
});
|
|
212
210
|
this._addMediaSection(mediaSection);
|
|
213
211
|
}
|
|
214
|
-
receiveSctpAssociation(
|
|
212
|
+
receiveSctpAssociation() {
|
|
215
213
|
const mediaSection = new MediaSection_1.OfferMediaSection({
|
|
216
214
|
iceParameters: this._iceParameters,
|
|
217
215
|
iceCandidates: this._iceCandidates,
|
|
@@ -220,7 +218,6 @@ class RemoteSdp {
|
|
|
220
218
|
plainRtpParameters: this._plainRtpParameters,
|
|
221
219
|
mid: 'datachannel',
|
|
222
220
|
kind: 'application',
|
|
223
|
-
oldDataChannelSpec,
|
|
224
221
|
});
|
|
225
222
|
this._addMediaSection(mediaSection);
|
|
226
223
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as SdpTransform from 'sdp-transform';
|
|
1
2
|
import type { DtlsParameters } from '../../Transport';
|
|
2
3
|
import type { RtpCapabilities, RtpParameters } from '../../RtpParameters';
|
|
3
4
|
/**
|
|
@@ -5,13 +6,13 @@ import type { RtpCapabilities, RtpParameters } from '../../RtpParameters';
|
|
|
5
6
|
* sections.
|
|
6
7
|
*/
|
|
7
8
|
export declare function extractRtpCapabilities({ sdpObject, }: {
|
|
8
|
-
sdpObject:
|
|
9
|
+
sdpObject: SdpTransform.SessionDescription;
|
|
9
10
|
}): RtpCapabilities;
|
|
10
11
|
export declare function extractDtlsParameters({ sdpObject, }: {
|
|
11
|
-
sdpObject:
|
|
12
|
+
sdpObject: SdpTransform.SessionDescription;
|
|
12
13
|
}): DtlsParameters;
|
|
13
14
|
export declare function getCname({ offerMediaObject, }: {
|
|
14
|
-
offerMediaObject:
|
|
15
|
+
offerMediaObject: SdpTransform.MediaDescription;
|
|
15
16
|
}): string;
|
|
16
17
|
/**
|
|
17
18
|
* Apply codec parameters in the given SDP m= section answer based on the
|
|
@@ -19,6 +20,6 @@ export declare function getCname({ offerMediaObject, }: {
|
|
|
19
20
|
*/
|
|
20
21
|
export declare function applyCodecParameters({ offerRtpParameters, answerMediaObject, }: {
|
|
21
22
|
offerRtpParameters: RtpParameters;
|
|
22
|
-
answerMediaObject:
|
|
23
|
+
answerMediaObject: SdpTransform.MediaDescription;
|
|
23
24
|
}): void;
|
|
24
25
|
//# sourceMappingURL=commonUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commonUtils.d.ts","sourceRoot":"","sources":["../../../src/handlers/sdp/commonUtils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"commonUtils.d.ts","sourceRoot":"","sources":["../../../src/handlers/sdp/commonUtils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,YAAY,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EACX,cAAc,EAGd,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACX,eAAe,EAIf,aAAa,EAEb,MAAM,qBAAqB,CAAC;AAE7B;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EACtC,SAAS,GACT,EAAE;IACF,SAAS,EAAE,YAAY,CAAC,kBAAkB,CAAC;CAC3C,GAAG,eAAe,CA8HlB;AAED,wBAAgB,qBAAqB,CAAC,EACrC,SAAS,GACT,EAAE;IACF,SAAS,EAAE,YAAY,CAAC,kBAAkB,CAAC;CAC3C,GAAG,cAAc,CAsDjB;AAED,wBAAgB,QAAQ,CAAC,EACxB,gBAAgB,GAChB,EAAE;IACF,gBAAgB,EAAE,YAAY,CAAC,gBAAgB,CAAC;CAChD,GAAG,MAAM,CAUT;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EACpC,kBAAkB,EAClB,iBAAiB,GACjB,EAAE;IACF,kBAAkB,EAAE,aAAa,CAAC;IAClC,iBAAiB,EAAE,YAAY,CAAC,gBAAgB,CAAC;CACjD,GAAG,IAAI,CAsDP"}
|
|
@@ -76,7 +76,7 @@ function extractRtpCapabilities({ sdpObject, }) {
|
|
|
76
76
|
// rtcp-fb payload is not '*', so just apply it to its corresponding
|
|
77
77
|
// codec.
|
|
78
78
|
if (fb.payload !== '*') {
|
|
79
|
-
const codec = codecsMap.get(fb.payload);
|
|
79
|
+
const codec = codecsMap.get(Number(fb.payload));
|
|
80
80
|
if (!codec) {
|
|
81
81
|
continue;
|
|
82
82
|
}
|
|
@@ -186,7 +186,7 @@ function applyCodecParameters({ offerRtpParameters, answerMediaObject, }) {
|
|
|
186
186
|
const parameters = sdpTransform.parseParams(fmtp.config);
|
|
187
187
|
switch (mimeType) {
|
|
188
188
|
case 'audio/opus': {
|
|
189
|
-
const spropStereo = codec.parameters['sprop-stereo'];
|
|
189
|
+
const spropStereo = codec.parameters?.['sprop-stereo'];
|
|
190
190
|
if (spropStereo !== undefined) {
|
|
191
191
|
parameters['stereo'] = Number(spropStereo) ? 1 : 0;
|
|
192
192
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import type * as SdpTransform from 'sdp-transform';
|
|
1
2
|
import type { MediaKind, RtpEncodingParameters } from '../../RtpParameters';
|
|
2
3
|
export declare function extractPlainRtpParameters({ sdpObject, kind, }: {
|
|
3
|
-
sdpObject:
|
|
4
|
+
sdpObject: SdpTransform.SessionDescription;
|
|
4
5
|
kind: MediaKind;
|
|
5
6
|
}): {
|
|
6
7
|
ip: string;
|
|
7
|
-
ipVersion:
|
|
8
|
+
ipVersion: number;
|
|
8
9
|
port: number;
|
|
9
10
|
};
|
|
10
11
|
export declare function getRtpEncodings({ sdpObject, kind, }: {
|
|
11
|
-
sdpObject:
|
|
12
|
+
sdpObject: SdpTransform.SessionDescription;
|
|
12
13
|
kind: MediaKind;
|
|
13
14
|
}): RtpEncodingParameters[];
|
|
14
15
|
//# sourceMappingURL=plainRtpUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plainRtpUtils.d.ts","sourceRoot":"","sources":["../../../src/handlers/sdp/plainRtpUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,wBAAgB,yBAAyB,CAAC,EACzC,SAAS,EACT,IAAI,GACJ,EAAE;IACF,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"plainRtpUtils.d.ts","sourceRoot":"","sources":["../../../src/handlers/sdp/plainRtpUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,YAAY,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,wBAAgB,yBAAyB,CAAC,EACzC,SAAS,EACT,IAAI,GACJ,EAAE;IACF,SAAS,EAAE,YAAY,CAAC,kBAAkB,CAAC;IAC3C,IAAI,EAAE,SAAS,CAAC;CAChB,GAAG;IACH,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACb,CAcA;AAED,wBAAgB,eAAe,CAAC,EAC/B,SAAS,EACT,IAAI,GACJ,EAAE;IACF,SAAS,EAAE,YAAY,CAAC,kBAAkB,CAAC;IAC3C,IAAI,EAAE,SAAS,CAAC;CAChB,GAAG,qBAAqB,EAAE,CAe1B"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.extractPlainRtpParameters = extractPlainRtpParameters;
|
|
4
4
|
exports.getRtpEncodings = getRtpEncodings;
|
|
5
5
|
function extractPlainRtpParameters({ sdpObject, kind, }) {
|
|
6
|
-
const mediaObject = (sdpObject.media ?? []).find(
|
|
6
|
+
const mediaObject = (sdpObject.media ?? []).find(m => m.type === kind);
|
|
7
7
|
if (!mediaObject) {
|
|
8
8
|
throw new Error(`m=${kind} section not found`);
|
|
9
9
|
}
|
|
@@ -15,7 +15,7 @@ function extractPlainRtpParameters({ sdpObject, kind, }) {
|
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
function getRtpEncodings({ sdpObject, kind, }) {
|
|
18
|
-
const mediaObject = (sdpObject.media ?? []).find(
|
|
18
|
+
const mediaObject = (sdpObject.media ?? []).find(m => m.type === kind);
|
|
19
19
|
if (!mediaObject) {
|
|
20
20
|
throw new Error(`m=${kind} section not found`);
|
|
21
21
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { RtpEncodingParameters } from '../../RtpParameters';
|
|
2
|
+
import type * as SdpTransform from 'sdp-transform';
|
|
2
3
|
export declare function getRtpEncodings({ offerMediaObject, }: {
|
|
3
|
-
offerMediaObject:
|
|
4
|
+
offerMediaObject: SdpTransform.MediaDescription;
|
|
4
5
|
}): RtpEncodingParameters[];
|
|
5
6
|
/**
|
|
6
7
|
* Adds multi-ssrc based simulcast into the given SDP media section offer.
|
|
7
8
|
*/
|
|
8
9
|
export declare function addLegacySimulcast({ offerMediaObject, numStreams, }: {
|
|
9
|
-
offerMediaObject:
|
|
10
|
+
offerMediaObject: SdpTransform.MediaDescription;
|
|
10
11
|
numStreams: number;
|
|
11
12
|
}): void;
|
|
12
13
|
//# sourceMappingURL=unifiedPlanUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unifiedPlanUtils.d.ts","sourceRoot":"","sources":["../../../src/handlers/sdp/unifiedPlanUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"unifiedPlanUtils.d.ts","sourceRoot":"","sources":["../../../src/handlers/sdp/unifiedPlanUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,KAAK,YAAY,MAAM,eAAe,CAAC;AAEnD,wBAAgB,eAAe,CAAC,EAC/B,gBAAgB,GAChB,EAAE;IACF,gBAAgB,EAAE,YAAY,CAAC,gBAAgB,CAAC;CAChD,GAAG,qBAAqB,EAAE,CA0D1B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,EAClC,gBAAgB,EAChB,UAAU,GACV,EAAE;IACF,gBAAgB,EAAE,YAAY,CAAC,gBAAgB,CAAC;IAChD,UAAU,EAAE,MAAM,CAAC;CACnB,GAAG,IAAI,CAsGP"}
|
|
@@ -6,7 +6,9 @@ function getRtpEncodings({ offerMediaObject, }) {
|
|
|
6
6
|
const ssrcs = new Set();
|
|
7
7
|
for (const line of offerMediaObject.ssrcs ?? []) {
|
|
8
8
|
const ssrc = line.id;
|
|
9
|
-
|
|
9
|
+
if (ssrc) {
|
|
10
|
+
ssrcs.add(ssrc);
|
|
11
|
+
}
|
|
10
12
|
}
|
|
11
13
|
if (ssrcs.size === 0) {
|
|
12
14
|
throw new Error('no a=ssrc lines found');
|
|
@@ -17,9 +19,9 @@ function getRtpEncodings({ offerMediaObject, }) {
|
|
|
17
19
|
if (line.semantics !== 'FID') {
|
|
18
20
|
continue;
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
ssrc = Number(
|
|
22
|
-
rtxSsrc = Number(
|
|
22
|
+
const ssrcsStr = line.ssrcs.split(/\s+/);
|
|
23
|
+
const ssrc = Number(ssrcsStr[0]);
|
|
24
|
+
const rtxSsrc = Number(ssrcsStr[1]);
|
|
23
25
|
if (ssrcs.has(ssrc)) {
|
|
24
26
|
// Remove both the SSRC and RTX SSRC from the set so later we know
|
|
25
27
|
// that they are already handled.
|
|
@@ -33,7 +35,7 @@ function getRtpEncodings({ offerMediaObject, }) {
|
|
|
33
35
|
// take media SSRCs from there.
|
|
34
36
|
for (const ssrc of ssrcs) {
|
|
35
37
|
// Add to the map.
|
|
36
|
-
ssrcToRtxSsrc.set(ssrc,
|
|
38
|
+
ssrcToRtxSsrc.set(ssrc, undefined);
|
|
37
39
|
}
|
|
38
40
|
const encodings = [];
|
|
39
41
|
for (const [ssrc, rtxSsrc] of ssrcToRtxSsrc) {
|
|
@@ -53,7 +55,7 @@ function addLegacySimulcast({ offerMediaObject, numStreams, }) {
|
|
|
53
55
|
throw new TypeError('numStreams must be greater than 1');
|
|
54
56
|
}
|
|
55
57
|
// Get the SSRC.
|
|
56
|
-
const ssrcMsidLine = (offerMediaObject.ssrcs ?? []).find(
|
|
58
|
+
const ssrcMsidLine = (offerMediaObject.ssrcs ?? []).find(line => line.attribute === 'msid');
|
|
57
59
|
if (!ssrcMsidLine) {
|
|
58
60
|
throw new Error('a=ssrc line with msid information not found');
|
|
59
61
|
}
|
|
@@ -61,7 +63,7 @@ function addLegacySimulcast({ offerMediaObject, numStreams, }) {
|
|
|
61
63
|
const firstSsrc = Number(ssrcMsidLine.id);
|
|
62
64
|
let firstRtxSsrc;
|
|
63
65
|
// Get the SSRC for RTX.
|
|
64
|
-
(offerMediaObject.ssrcGroups ?? []).some(
|
|
66
|
+
(offerMediaObject.ssrcGroups ?? []).some(line => {
|
|
65
67
|
if (line.semantics !== 'FID') {
|
|
66
68
|
return false;
|
|
67
69
|
}
|
|
@@ -74,7 +76,7 @@ function addLegacySimulcast({ offerMediaObject, numStreams, }) {
|
|
|
74
76
|
return false;
|
|
75
77
|
}
|
|
76
78
|
});
|
|
77
|
-
const ssrcCnameLine = offerMediaObject.ssrcs.find(
|
|
79
|
+
const ssrcCnameLine = (offerMediaObject.ssrcs ?? []).find(line => line.attribute === 'cname');
|
|
78
80
|
if (!ssrcCnameLine) {
|
|
79
81
|
throw new Error('a=ssrc line with cname information not found');
|
|
80
82
|
}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/lib/ortc.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RtpCapabilities, MediaKind, RtpCodecCapability, RtpParameters, RtpCodecParameters } from './RtpParameters';
|
|
2
2
|
import type { SctpCapabilities, SctpStreamParameters } from './SctpParameters';
|
|
3
|
+
import type { ExtendedRtpCapabilities } from './privateTypes';
|
|
3
4
|
/**
|
|
4
5
|
* Validates RtpCapabilities. It may modify given data by adding missing
|
|
5
6
|
* fields with default values.
|
|
@@ -30,21 +31,21 @@ export declare function validateSctpCapabilities(caps: SctpCapabilities): void;
|
|
|
30
31
|
* Resulting codecs keep order preferrred by local or remote capabilities
|
|
31
32
|
* depending on `preferLocalCodecsOrder`.
|
|
32
33
|
*/
|
|
33
|
-
export declare function getExtendedRtpCapabilities(localCaps: RtpCapabilities, remoteCaps: RtpCapabilities, preferLocalCodecsOrder: boolean):
|
|
34
|
+
export declare function getExtendedRtpCapabilities(localCaps: RtpCapabilities, remoteCaps: RtpCapabilities, preferLocalCodecsOrder: boolean): ExtendedRtpCapabilities;
|
|
34
35
|
/**
|
|
35
36
|
* Generate RTP capabilities for receiving media based on the given extended
|
|
36
37
|
* RTP capabilities.
|
|
37
38
|
*/
|
|
38
|
-
export declare function getRecvRtpCapabilities(extendedRtpCapabilities:
|
|
39
|
+
export declare function getRecvRtpCapabilities(extendedRtpCapabilities: ExtendedRtpCapabilities): RtpCapabilities;
|
|
39
40
|
/**
|
|
40
41
|
* Generate RTP parameters of the given kind for sending media.
|
|
41
42
|
* NOTE: mid, encodings and rtcp fields are left empty.
|
|
42
43
|
*/
|
|
43
|
-
export declare function getSendingRtpParameters(kind: MediaKind, extendedRtpCapabilities:
|
|
44
|
+
export declare function getSendingRtpParameters(kind: MediaKind, extendedRtpCapabilities: ExtendedRtpCapabilities): RtpParameters;
|
|
44
45
|
/**
|
|
45
46
|
* Generate RTP parameters of the given kind suitable for the remote SDP answer.
|
|
46
47
|
*/
|
|
47
|
-
export declare function getSendingRemoteRtpParameters(kind: MediaKind, extendedRtpCapabilities:
|
|
48
|
+
export declare function getSendingRemoteRtpParameters(kind: MediaKind, extendedRtpCapabilities: ExtendedRtpCapabilities): RtpParameters;
|
|
48
49
|
/**
|
|
49
50
|
* Reduce given codecs by returning an array of codecs "compatible" with the
|
|
50
51
|
* given capability codec. If no capability codec is given, take the first
|
|
@@ -63,10 +64,10 @@ export declare function generateProbatorRtpParameters(videoRtpParameters: RtpPar
|
|
|
63
64
|
/**
|
|
64
65
|
* Whether media can be sent based on the given RTP capabilities.
|
|
65
66
|
*/
|
|
66
|
-
export declare function canSend(kind: MediaKind, extendedRtpCapabilities:
|
|
67
|
+
export declare function canSend(kind: MediaKind, extendedRtpCapabilities: ExtendedRtpCapabilities): boolean;
|
|
67
68
|
/**
|
|
68
69
|
* Whether the given RTP parameters can be received with the given RTP
|
|
69
70
|
* capabilities.
|
|
70
71
|
*/
|
|
71
|
-
export declare function canReceive(rtpParameters: RtpParameters, extendedRtpCapabilities:
|
|
72
|
+
export declare function canReceive(rtpParameters: RtpParameters, extendedRtpCapabilities: ExtendedRtpCapabilities): boolean;
|
|
72
73
|
//# sourceMappingURL=ortc.d.ts.map
|
package/lib/ortc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ortc.d.ts","sourceRoot":"","sources":["../src/ortc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,eAAe,EACf,SAAS,EACT,kBAAkB,EAElB,aAAa,EACb,kBAAkB,EAKlB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACX,gBAAgB,EAEhB,oBAAoB,EACpB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ortc.d.ts","sourceRoot":"","sources":["../src/ortc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,eAAe,EACf,SAAS,EACT,kBAAkB,EAElB,aAAa,EACb,kBAAkB,EAKlB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACX,gBAAgB,EAEhB,oBAAoB,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACX,uBAAuB,EAGvB,MAAM,gBAAgB,CAAC;AAOxB;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CA0BnE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAiDjE;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC3C,MAAM,EAAE,oBAAoB,GAC1B,IAAI,CA8DN;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAWrE;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACzC,SAAS,EAAE,eAAe,EAC1B,UAAU,EAAE,eAAe,EAC3B,sBAAsB,EAAE,OAAO,GAC7B,uBAAuB,CAiJzB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACrC,uBAAuB,EAAE,uBAAuB,GAC9C,eAAe,CA6DjB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACtC,IAAI,EAAE,SAAS,EACf,uBAAuB,EAAE,uBAAuB,GAC9C,aAAa,CA8Df;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC5C,IAAI,EAAE,SAAS,EACf,uBAAuB,EAAE,uBAAuB,GAC9C,aAAa,CA+Ff;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC3B,MAAM,EAAE,kBAAkB,EAAE,EAC5B,QAAQ,CAAC,EAAE,kBAAkB,GAC3B,kBAAkB,EAAE,CA+BtB;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC5C,kBAAkB,EAAE,aAAa,GAC/B,aAAa,CAoBf;AAED;;GAEG;AACH,wBAAgB,OAAO,CACtB,IAAI,EAAE,SAAS,EACf,uBAAuB,EAAE,uBAAuB,GAC9C,OAAO,CAET;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACzB,aAAa,EAAE,aAAa,EAC5B,uBAAuB,EAAE,uBAAuB,GAC9C,OAAO,CAaT"}
|
package/lib/ortc.js
CHANGED
|
@@ -192,8 +192,8 @@ function getExtendedRtpCapabilities(localCaps, remoteCaps, preferLocalCodecsOrde
|
|
|
192
192
|
localRtxPayloadType: undefined,
|
|
193
193
|
remotePayloadType: matchingRemoteCodec.preferredPayloadType,
|
|
194
194
|
remoteRtxPayloadType: undefined,
|
|
195
|
-
localParameters: localCodec.parameters,
|
|
196
|
-
remoteParameters: matchingRemoteCodec.parameters,
|
|
195
|
+
localParameters: localCodec.parameters ?? {},
|
|
196
|
+
remoteParameters: matchingRemoteCodec.parameters ?? {},
|
|
197
197
|
rtcpFeedback: reduceRtcpFeedback(localCodec, matchingRemoteCodec),
|
|
198
198
|
};
|
|
199
199
|
extendedRtpCapabilities.codecs.push(extendedCodec);
|
|
@@ -218,8 +218,8 @@ function getExtendedRtpCapabilities(localCaps, remoteCaps, preferLocalCodecsOrde
|
|
|
218
218
|
localRtxPayloadType: undefined,
|
|
219
219
|
remotePayloadType: remoteCodec.preferredPayloadType,
|
|
220
220
|
remoteRtxPayloadType: undefined,
|
|
221
|
-
localParameters: matchingLocalCodec.parameters,
|
|
222
|
-
remoteParameters: remoteCodec.parameters,
|
|
221
|
+
localParameters: matchingLocalCodec.parameters ?? {},
|
|
222
|
+
remoteParameters: remoteCodec.parameters ?? {},
|
|
223
223
|
rtcpFeedback: reduceRtcpFeedback(matchingLocalCodec, remoteCodec),
|
|
224
224
|
};
|
|
225
225
|
extendedRtpCapabilities.codecs.push(extendedCodec);
|
|
@@ -228,9 +228,9 @@ function getExtendedRtpCapabilities(localCaps, remoteCaps, preferLocalCodecsOrde
|
|
|
228
228
|
// Match RTX codecs.
|
|
229
229
|
for (const extendedCodec of extendedRtpCapabilities.codecs) {
|
|
230
230
|
const matchingLocalRtxCodec = localCaps.codecs.find((localCodec) => isRtxCodec(localCodec) &&
|
|
231
|
-
localCodec.parameters
|
|
231
|
+
localCodec.parameters?.['apt'] === extendedCodec.localPayloadType);
|
|
232
232
|
const matchingRemoteRtxCodec = remoteCaps.codecs.find((remoteCodec) => isRtxCodec(remoteCodec) &&
|
|
233
|
-
remoteCodec.parameters
|
|
233
|
+
remoteCodec.parameters?.['apt'] === extendedCodec.remotePayloadType);
|
|
234
234
|
if (matchingLocalRtxCodec && matchingRemoteRtxCodec) {
|
|
235
235
|
extendedCodec.localRtxPayloadType =
|
|
236
236
|
matchingLocalRtxCodec.preferredPayloadType;
|
|
@@ -249,7 +249,7 @@ function getExtendedRtpCapabilities(localCaps, remoteCaps, preferLocalCodecsOrde
|
|
|
249
249
|
uri: remoteExt.uri,
|
|
250
250
|
sendId: matchingLocalExt.preferredId,
|
|
251
251
|
recvId: remoteExt.preferredId,
|
|
252
|
-
encrypt: matchingLocalExt.preferredEncrypt,
|
|
252
|
+
encrypt: matchingLocalExt.preferredEncrypt ?? false,
|
|
253
253
|
direction: 'sendrecv',
|
|
254
254
|
};
|
|
255
255
|
switch (remoteExt.direction) {
|
|
@@ -321,7 +321,7 @@ function getRecvRtpCapabilities(extendedRtpCapabilities) {
|
|
|
321
321
|
kind: extendedExtension.kind,
|
|
322
322
|
uri: extendedExtension.uri,
|
|
323
323
|
preferredId: extendedExtension.recvId,
|
|
324
|
-
preferredEncrypt: extendedExtension.encrypt,
|
|
324
|
+
preferredEncrypt: extendedExtension.encrypt ?? false,
|
|
325
325
|
direction: extendedExtension.direction,
|
|
326
326
|
};
|
|
327
327
|
rtpCapabilities.headerExtensions.push(ext);
|
|
@@ -516,7 +516,7 @@ function generateProbatorRtpParameters(videoRtpParameters) {
|
|
|
516
516
|
* Whether media can be sent based on the given RTP capabilities.
|
|
517
517
|
*/
|
|
518
518
|
function canSend(kind, extendedRtpCapabilities) {
|
|
519
|
-
return extendedRtpCapabilities.codecs.some(
|
|
519
|
+
return extendedRtpCapabilities.codecs.some(codec => codec.kind === kind);
|
|
520
520
|
}
|
|
521
521
|
/**
|
|
522
522
|
* Whether the given RTP parameters can be received with the given RTP
|
|
@@ -529,7 +529,7 @@ function canReceive(rtpParameters, extendedRtpCapabilities) {
|
|
|
529
529
|
return false;
|
|
530
530
|
}
|
|
531
531
|
const firstMediaCodec = rtpParameters.codecs[0];
|
|
532
|
-
return extendedRtpCapabilities.codecs.some(
|
|
532
|
+
return extendedRtpCapabilities.codecs.some(codec => codec.remotePayloadType === firstMediaCodec.payloadType);
|
|
533
533
|
}
|
|
534
534
|
/**
|
|
535
535
|
* Validates RtpCodecCapability. It may modify given data by adding missing
|
|
@@ -551,10 +551,9 @@ function validateRtpCodecCapability(codec) {
|
|
|
551
551
|
}
|
|
552
552
|
// Just override kind with media component of mimeType.
|
|
553
553
|
codec.kind = mimeTypeMatch[1].toLowerCase();
|
|
554
|
-
// preferredPayloadType is
|
|
555
|
-
if (codec.preferredPayloadType
|
|
556
|
-
|
|
557
|
-
throw new TypeError('invalid codec.preferredPayloadType');
|
|
554
|
+
// preferredPayloadType is mandatory.
|
|
555
|
+
if (typeof codec.preferredPayloadType !== 'number') {
|
|
556
|
+
throw new TypeError('missing codec.preferredPayloadType');
|
|
558
557
|
}
|
|
559
558
|
// clockRate is mandatory.
|
|
560
559
|
if (typeof codec.clockRate !== 'number') {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { MediaKind, RtcpFeedback, RtpHeaderExtensionUri, RtpHeaderExtensionDirection } from './RtpParameters';
|
|
2
|
+
export type ExtendedRtpCapabilities = {
|
|
3
|
+
codecs: ExtendedRtpCodecCapability[];
|
|
4
|
+
headerExtensions: ExtendedRtpHeaderExtension[];
|
|
5
|
+
};
|
|
6
|
+
export type ExtendedRtpCodecCapability = {
|
|
7
|
+
mimeType: string;
|
|
8
|
+
kind: MediaKind;
|
|
9
|
+
localPayloadType: number;
|
|
10
|
+
localRtxPayloadType?: number;
|
|
11
|
+
remotePayloadType: number;
|
|
12
|
+
remoteRtxPayloadType?: number;
|
|
13
|
+
clockRate: number;
|
|
14
|
+
channels?: number;
|
|
15
|
+
localParameters: Record<string, unknown>;
|
|
16
|
+
remoteParameters: Record<string, unknown>;
|
|
17
|
+
rtcpFeedback?: RtcpFeedback[];
|
|
18
|
+
};
|
|
19
|
+
export type ExtendedRtpHeaderExtension = {
|
|
20
|
+
kind: MediaKind;
|
|
21
|
+
uri: RtpHeaderExtensionUri;
|
|
22
|
+
sendId: number;
|
|
23
|
+
recvId: number;
|
|
24
|
+
encrypt: boolean;
|
|
25
|
+
direction: RtpHeaderExtensionDirection;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=privateTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"privateTypes.d.ts","sourceRoot":"","sources":["../src/privateTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,SAAS,EACT,YAAY,EACZ,qBAAqB,EACrB,2BAA2B,EAC3B,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,uBAAuB,GAAG;IACrC,MAAM,EAAE,0BAA0B,EAAE,CAAC;IACrC,gBAAgB,EAAE,0BAA0B,EAAE,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACxC,IAAI,EAAE,SAAS,CAAC;IAChB,GAAG,EAAE,qBAAqB,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,2BAA2B,CAAC;CACvC,CAAC"}
|
package/lib/test/test.js
CHANGED
|
@@ -1165,9 +1165,26 @@ describe('detectDevice() and detectDeviceAsync() assign proper handler based on
|
|
|
1165
1165
|
// We need to force presence of RTCRtpTransceiver to test Safari 12.
|
|
1166
1166
|
if (uaTestCase.expect === 'Safari12') {
|
|
1167
1167
|
global.RTCRtpTransceiver = class Dummy {
|
|
1168
|
-
|
|
1168
|
+
// eslint-disable-next-line @typescript-eslint/class-literal-property-style
|
|
1169
|
+
get currentDirection() {
|
|
1169
1170
|
return 'sendrecv';
|
|
1170
1171
|
}
|
|
1172
|
+
// eslint-disable-next-line @typescript-eslint/class-literal-property-style
|
|
1173
|
+
get direction() {
|
|
1174
|
+
return 'sendrecv';
|
|
1175
|
+
}
|
|
1176
|
+
// eslint-disable-next-line @typescript-eslint/class-literal-property-style
|
|
1177
|
+
get mid() {
|
|
1178
|
+
return 'foo';
|
|
1179
|
+
}
|
|
1180
|
+
get receiver() {
|
|
1181
|
+
return {};
|
|
1182
|
+
}
|
|
1183
|
+
get sender() {
|
|
1184
|
+
return {};
|
|
1185
|
+
}
|
|
1186
|
+
setCodecPreferences() { }
|
|
1187
|
+
stop() { }
|
|
1171
1188
|
};
|
|
1172
1189
|
}
|
|
1173
1190
|
expect(detectDevice(uaTestCase.ua)).toBe(uaTestCase.expect);
|
package/lib/utils.d.ts
CHANGED
|
@@ -10,5 +10,5 @@ export declare function generateRandomNumber(): number;
|
|
|
10
10
|
* Make an object or array recursively immutable.
|
|
11
11
|
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze.
|
|
12
12
|
*/
|
|
13
|
-
export declare function deepFreeze<T>(
|
|
13
|
+
export declare function deepFreeze<T>(data: T): T;
|
|
14
14
|
//# sourceMappingURL=utils.d.ts.map
|
package/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAWpC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAWpC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAexC"}
|
package/lib/utils.js
CHANGED
|
@@ -31,15 +31,16 @@ function generateRandomNumber() {
|
|
|
31
31
|
* Make an object or array recursively immutable.
|
|
32
32
|
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze.
|
|
33
33
|
*/
|
|
34
|
-
function deepFreeze(
|
|
34
|
+
function deepFreeze(data) {
|
|
35
35
|
// Retrieve the property names defined on object.
|
|
36
|
-
const propNames = Reflect.ownKeys(
|
|
36
|
+
const propNames = Reflect.ownKeys(data);
|
|
37
37
|
// Freeze properties before freezing self.
|
|
38
38
|
for (const name of propNames) {
|
|
39
|
-
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
+
const value = data[name];
|
|
40
41
|
if ((value && typeof value === 'object') || typeof value === 'function') {
|
|
41
42
|
deepFreeze(value);
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
|
-
return Object.freeze(
|
|
45
|
+
return Object.freeze(data);
|
|
45
46
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mediasoup-client",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.0",
|
|
4
4
|
"description": "mediasoup client side TypeScript library",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
|
|
@@ -82,7 +82,6 @@
|
|
|
82
82
|
"@eslint/js": "^9.32.0",
|
|
83
83
|
"@types/jest": "^30.0.0",
|
|
84
84
|
"@types/node": "^24.1.0",
|
|
85
|
-
"@types/sdp-transform": "^2.4.10",
|
|
86
85
|
"@types/ua-parser-js": "^0.7.39",
|
|
87
86
|
"eslint": "^9.32.0",
|
|
88
87
|
"eslint-config-prettier": "^10.1.8",
|