@webex/web-client-media-engine 3.22.2 → 3.22.4
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/dist/cjs/index.js +61 -21
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +61 -21
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -9415,30 +9415,26 @@ function disableRtcpFbValue(sdpOrAv, rtcpFbValue) {
|
|
|
9415
9415
|
function disableTwcc(sdpOrAv) {
|
|
9416
9416
|
disableRtcpFbValue(sdpOrAv, 'transport-cc');
|
|
9417
9417
|
}
|
|
9418
|
-
function
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
|
|
9422
|
-
|
|
9418
|
+
function retainCodecs(av, predicate) {
|
|
9419
|
+
let filtered = false;
|
|
9420
|
+
av.codecs.forEach((codecInfo) => {
|
|
9421
|
+
if (!predicate(codecInfo)) {
|
|
9422
|
+
av.removePt(codecInfo.pt);
|
|
9423
|
+
filtered = true;
|
|
9424
|
+
}
|
|
9423
9425
|
});
|
|
9426
|
+
return filtered;
|
|
9424
9427
|
}
|
|
9425
|
-
function
|
|
9426
|
-
const avMediaDescriptions = sdpOrAv instanceof Sdp ? sdpOrAv.avMedia : [sdpOrAv];
|
|
9428
|
+
function retainCodecsByCodecName(av, allowedCodecNames) {
|
|
9427
9429
|
const allowedLowerCase = allowedCodecNames.map((s) => s.toLowerCase());
|
|
9428
|
-
|
|
9429
|
-
.map((av) => {
|
|
9430
|
-
return [...av.codecs.values()].map((c) => c.name);
|
|
9431
|
-
})
|
|
9432
|
-
.flat()
|
|
9433
|
-
.filter((codecName) => !allowedLowerCase.includes(codecName.toLowerCase()))
|
|
9434
|
-
.forEach((unwantedCodec) => removeCodec(sdpOrAv, unwantedCodec));
|
|
9430
|
+
return retainCodecs(av, (codecInfo) => !!codecInfo.name && allowedLowerCase.includes(codecInfo.name.toLowerCase()));
|
|
9435
9431
|
}
|
|
9436
|
-
function retainCandidates(sdpOrMedia,
|
|
9432
|
+
function retainCandidates(sdpOrMedia, predicate) {
|
|
9437
9433
|
const mediaDescriptions = sdpOrMedia instanceof Sdp ? sdpOrMedia.media : [sdpOrMedia];
|
|
9438
9434
|
let filtered = false;
|
|
9439
9435
|
mediaDescriptions.forEach((media) => {
|
|
9440
9436
|
media.iceInfo.candidates = media.iceInfo.candidates.filter((candidate) => {
|
|
9441
|
-
if (
|
|
9437
|
+
if (predicate(candidate)) {
|
|
9442
9438
|
return true;
|
|
9443
9439
|
}
|
|
9444
9440
|
filtered = true;
|
|
@@ -9446,6 +9442,10 @@ function retainCandidates(sdpOrMedia, allowedTransportTypes) {
|
|
|
9446
9442
|
});
|
|
9447
9443
|
});
|
|
9448
9444
|
return filtered;
|
|
9445
|
+
}
|
|
9446
|
+
function retainCandidatesByTransportType(sdpOrMedia, allowedTransportTypes) {
|
|
9447
|
+
const allowedLowerCase = allowedTransportTypes.map((s) => s.toLowerCase());
|
|
9448
|
+
return retainCandidates(sdpOrMedia, (candidate) => allowedLowerCase.includes(candidate.transport.toLowerCase()));
|
|
9449
9449
|
}
|
|
9450
9450
|
|
|
9451
9451
|
function hasCodec(codecName, mLine) {
|
|
@@ -9473,6 +9473,12 @@ var BrowserName;
|
|
|
9473
9473
|
BrowserName["EDGE"] = "Microsoft Edge";
|
|
9474
9474
|
BrowserName["SAFARI"] = "Safari";
|
|
9475
9475
|
})(BrowserName || (BrowserName = {}));
|
|
9476
|
+
var OSName;
|
|
9477
|
+
(function (OSName) {
|
|
9478
|
+
OSName["WINDOWS"] = "Windows";
|
|
9479
|
+
OSName["MAC"] = "macOS";
|
|
9480
|
+
OSName["LINUX"] = "Linux";
|
|
9481
|
+
})(OSName || (OSName = {}));
|
|
9476
9482
|
class BrowserInfo {
|
|
9477
9483
|
static getBrowserDetails() {
|
|
9478
9484
|
return this.browser.getBrowser();
|
|
@@ -9498,6 +9504,15 @@ class BrowserInfo {
|
|
|
9498
9504
|
static isSafari() {
|
|
9499
9505
|
return this.browser.getBrowserName() === BrowserName.SAFARI;
|
|
9500
9506
|
}
|
|
9507
|
+
static isWindows() {
|
|
9508
|
+
return this.browser.getOSName() === OSName.WINDOWS;
|
|
9509
|
+
}
|
|
9510
|
+
static isMac() {
|
|
9511
|
+
return this.browser.getOSName() === OSName.MAC;
|
|
9512
|
+
}
|
|
9513
|
+
static isLinux() {
|
|
9514
|
+
return this.browser.getOSName() === OSName.LINUX;
|
|
9515
|
+
}
|
|
9501
9516
|
static isVersionGreaterThan(version) {
|
|
9502
9517
|
const browserName = this.browser.getBrowserName();
|
|
9503
9518
|
const checkTree = { [browserName]: `>${version}` };
|
|
@@ -9761,7 +9776,23 @@ class EgressSdpMunger {
|
|
|
9761
9776
|
}
|
|
9762
9777
|
mungeLocalDescription(mediaDescription, options) {
|
|
9763
9778
|
var _a;
|
|
9764
|
-
|
|
9779
|
+
retainCodecsByCodecName(mediaDescription, ['h264', 'opus', 'rtx']);
|
|
9780
|
+
if (options.forceSoftwareEncoder) {
|
|
9781
|
+
const isH264Cbp = (codecInfo) => {
|
|
9782
|
+
var _a;
|
|
9783
|
+
if (((_a = codecInfo.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'h264') {
|
|
9784
|
+
const profileLevelId = codecInfo.fmtParams.get('profile-level-id');
|
|
9785
|
+
return !!profileLevelId && /^42[^0]/.test(profileLevelId);
|
|
9786
|
+
}
|
|
9787
|
+
return false;
|
|
9788
|
+
};
|
|
9789
|
+
if ([...mediaDescription.codecs.values()].some(isH264Cbp)) {
|
|
9790
|
+
retainCodecs(mediaDescription, (codecInfo) => { var _a; return ((_a = codecInfo.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== 'h264' || isH264Cbp(codecInfo); });
|
|
9791
|
+
}
|
|
9792
|
+
else {
|
|
9793
|
+
logger.log(`No H.264 CBP present in m-line with MID ${mediaDescription.mid}, so all H.264 codecs have been retained.`);
|
|
9794
|
+
}
|
|
9795
|
+
}
|
|
9765
9796
|
if (mediaDescription.codecs.size === 0) {
|
|
9766
9797
|
logErrorAndThrow(exports.WcmeErrorType.SDP_MUNGE_MISSING_CODECS, `No codecs present in m-line with MID ${mediaDescription.mid} after filtering.`);
|
|
9767
9798
|
}
|
|
@@ -9856,7 +9887,7 @@ class EgressSdpMunger {
|
|
|
9856
9887
|
}
|
|
9857
9888
|
}
|
|
9858
9889
|
mungeRemoteDescription(mediaDescription) {
|
|
9859
|
-
if (
|
|
9890
|
+
if (retainCandidatesByTransportType(mediaDescription, ['udp', 'tcp'])) {
|
|
9860
9891
|
logger.log(`Some unsupported remote candidates have been removed from mid ${mediaDescription.mid}`);
|
|
9861
9892
|
}
|
|
9862
9893
|
mediaDescription.bandwidth = undefined;
|
|
@@ -10369,7 +10400,7 @@ class IngressSdpMunger {
|
|
|
10369
10400
|
return Object.assign({ ssrc: this.ssrc }, (this.rtxSsrc ? { rtxSsrc: this.rtxSsrc } : {}));
|
|
10370
10401
|
}
|
|
10371
10402
|
mungeLocalDescription(mediaDescription, options) {
|
|
10372
|
-
|
|
10403
|
+
retainCodecsByCodecName(mediaDescription, ['h264', 'opus', 'rtx']);
|
|
10373
10404
|
if (mediaDescription.codecs.size === 0) {
|
|
10374
10405
|
logErrorAndThrow(exports.WcmeErrorType.SDP_MUNGE_MISSING_CODECS, `No codecs present in m-line with MID ${mediaDescription.mid} after filtering.`);
|
|
10375
10406
|
}
|
|
@@ -10391,7 +10422,7 @@ class IngressSdpMunger {
|
|
|
10391
10422
|
mediaDescription.addLine(new SsrcGroupLine('FID', [this.ssrc, this.rtxSsrc]));
|
|
10392
10423
|
}
|
|
10393
10424
|
}
|
|
10394
|
-
if (
|
|
10425
|
+
if (retainCandidatesByTransportType(mediaDescription, ['udp', 'tcp'])) {
|
|
10395
10426
|
logger.log(`Some unsupported remote candidates have been removed from mid ${mediaDescription.mid}`);
|
|
10396
10427
|
}
|
|
10397
10428
|
[...mediaDescription.codecs.values()].forEach((ci) => {
|
|
@@ -14579,6 +14610,9 @@ class SendOnlyTransceiver extends Transceiver {
|
|
|
14579
14610
|
simulcastEnabled: this.isSimulcastEnabled(),
|
|
14580
14611
|
rtxEnabled: this.rtxEnabled,
|
|
14581
14612
|
twccDisabled: this.twccDisabled,
|
|
14613
|
+
forceSoftwareEncoder: this.mediaType === exports.MediaType.VideoSlides &&
|
|
14614
|
+
(BrowserInfo.isWindows() || BrowserInfo.isMac()) &&
|
|
14615
|
+
(BrowserInfo.isChrome() || BrowserInfo.isEdge()),
|
|
14582
14616
|
});
|
|
14583
14617
|
}
|
|
14584
14618
|
mungeLocalDescriptionForRemoteServer(mediaDescription) {
|
|
@@ -15386,6 +15420,12 @@ SCTP Max Message Size: ${maxMessageSize}`);
|
|
|
15386
15420
|
injectDummyCandidates(media);
|
|
15387
15421
|
});
|
|
15388
15422
|
}
|
|
15423
|
+
if (BrowserInfo.isFirefox() && this.options.doFullIce) {
|
|
15424
|
+
const { candidates } = parsedOffer.media[0].iceInfo;
|
|
15425
|
+
parsedOffer.media.forEach((media) => {
|
|
15426
|
+
media.iceInfo.candidates = candidates;
|
|
15427
|
+
});
|
|
15428
|
+
}
|
|
15389
15429
|
if (BrowserInfo.isFirefox()) {
|
|
15390
15430
|
setupBundle(parsedOffer, this.options.bundlePolicy, this.midPredictor.getMidMap());
|
|
15391
15431
|
if (this.options.bundlePolicy === 'max-bundle') {
|
|
@@ -15419,7 +15459,7 @@ SCTP Max Message Size: ${maxMessageSize}`);
|
|
|
15419
15459
|
parsedAnswer.media
|
|
15420
15460
|
.filter((media) => media instanceof ApplicationMediaDescription)
|
|
15421
15461
|
.forEach((media) => {
|
|
15422
|
-
if (
|
|
15462
|
+
if (retainCandidatesByTransportType(media, ['udp', 'tcp'])) {
|
|
15423
15463
|
logger.log(`Some unsupported remote candidates have been removed from mid ${media.mid}`);
|
|
15424
15464
|
}
|
|
15425
15465
|
});
|