@webex/web-client-media-engine 3.22.2 → 3.22.3
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 +55 -21
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +55 -21
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +3 -3
package/dist/esm/index.js
CHANGED
|
@@ -9411,30 +9411,26 @@ function disableRtcpFbValue(sdpOrAv, rtcpFbValue) {
|
|
|
9411
9411
|
function disableTwcc(sdpOrAv) {
|
|
9412
9412
|
disableRtcpFbValue(sdpOrAv, 'transport-cc');
|
|
9413
9413
|
}
|
|
9414
|
-
function
|
|
9415
|
-
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
|
|
9414
|
+
function retainCodecs(av, predicate) {
|
|
9415
|
+
let filtered = false;
|
|
9416
|
+
av.codecs.forEach((codecInfo) => {
|
|
9417
|
+
if (!predicate(codecInfo)) {
|
|
9418
|
+
av.removePt(codecInfo.pt);
|
|
9419
|
+
filtered = true;
|
|
9420
|
+
}
|
|
9419
9421
|
});
|
|
9422
|
+
return filtered;
|
|
9420
9423
|
}
|
|
9421
|
-
function
|
|
9422
|
-
const avMediaDescriptions = sdpOrAv instanceof Sdp ? sdpOrAv.avMedia : [sdpOrAv];
|
|
9424
|
+
function retainCodecsByCodecName(av, allowedCodecNames) {
|
|
9423
9425
|
const allowedLowerCase = allowedCodecNames.map((s) => s.toLowerCase());
|
|
9424
|
-
|
|
9425
|
-
.map((av) => {
|
|
9426
|
-
return [...av.codecs.values()].map((c) => c.name);
|
|
9427
|
-
})
|
|
9428
|
-
.flat()
|
|
9429
|
-
.filter((codecName) => !allowedLowerCase.includes(codecName.toLowerCase()))
|
|
9430
|
-
.forEach((unwantedCodec) => removeCodec(sdpOrAv, unwantedCodec));
|
|
9426
|
+
return retainCodecs(av, (codecInfo) => !!codecInfo.name && allowedLowerCase.includes(codecInfo.name.toLowerCase()));
|
|
9431
9427
|
}
|
|
9432
|
-
function retainCandidates(sdpOrMedia,
|
|
9428
|
+
function retainCandidates(sdpOrMedia, predicate) {
|
|
9433
9429
|
const mediaDescriptions = sdpOrMedia instanceof Sdp ? sdpOrMedia.media : [sdpOrMedia];
|
|
9434
9430
|
let filtered = false;
|
|
9435
9431
|
mediaDescriptions.forEach((media) => {
|
|
9436
9432
|
media.iceInfo.candidates = media.iceInfo.candidates.filter((candidate) => {
|
|
9437
|
-
if (
|
|
9433
|
+
if (predicate(candidate)) {
|
|
9438
9434
|
return true;
|
|
9439
9435
|
}
|
|
9440
9436
|
filtered = true;
|
|
@@ -9442,6 +9438,10 @@ function retainCandidates(sdpOrMedia, allowedTransportTypes) {
|
|
|
9442
9438
|
});
|
|
9443
9439
|
});
|
|
9444
9440
|
return filtered;
|
|
9441
|
+
}
|
|
9442
|
+
function retainCandidatesByTransportType(sdpOrMedia, allowedTransportTypes) {
|
|
9443
|
+
const allowedLowerCase = allowedTransportTypes.map((s) => s.toLowerCase());
|
|
9444
|
+
return retainCandidates(sdpOrMedia, (candidate) => allowedLowerCase.includes(candidate.transport.toLowerCase()));
|
|
9445
9445
|
}
|
|
9446
9446
|
|
|
9447
9447
|
function hasCodec(codecName, mLine) {
|
|
@@ -9469,6 +9469,12 @@ var BrowserName;
|
|
|
9469
9469
|
BrowserName["EDGE"] = "Microsoft Edge";
|
|
9470
9470
|
BrowserName["SAFARI"] = "Safari";
|
|
9471
9471
|
})(BrowserName || (BrowserName = {}));
|
|
9472
|
+
var OSName;
|
|
9473
|
+
(function (OSName) {
|
|
9474
|
+
OSName["WINDOWS"] = "Windows";
|
|
9475
|
+
OSName["MAC"] = "macOS";
|
|
9476
|
+
OSName["LINUX"] = "Linux";
|
|
9477
|
+
})(OSName || (OSName = {}));
|
|
9472
9478
|
class BrowserInfo {
|
|
9473
9479
|
static getBrowserDetails() {
|
|
9474
9480
|
return this.browser.getBrowser();
|
|
@@ -9494,6 +9500,15 @@ class BrowserInfo {
|
|
|
9494
9500
|
static isSafari() {
|
|
9495
9501
|
return this.browser.getBrowserName() === BrowserName.SAFARI;
|
|
9496
9502
|
}
|
|
9503
|
+
static isWindows() {
|
|
9504
|
+
return this.browser.getOSName() === OSName.WINDOWS;
|
|
9505
|
+
}
|
|
9506
|
+
static isMac() {
|
|
9507
|
+
return this.browser.getOSName() === OSName.MAC;
|
|
9508
|
+
}
|
|
9509
|
+
static isLinux() {
|
|
9510
|
+
return this.browser.getOSName() === OSName.LINUX;
|
|
9511
|
+
}
|
|
9497
9512
|
static isVersionGreaterThan(version) {
|
|
9498
9513
|
const browserName = this.browser.getBrowserName();
|
|
9499
9514
|
const checkTree = { [browserName]: `>${version}` };
|
|
@@ -9757,7 +9772,23 @@ class EgressSdpMunger {
|
|
|
9757
9772
|
}
|
|
9758
9773
|
mungeLocalDescription(mediaDescription, options) {
|
|
9759
9774
|
var _a;
|
|
9760
|
-
|
|
9775
|
+
retainCodecsByCodecName(mediaDescription, ['h264', 'opus', 'rtx']);
|
|
9776
|
+
if (options.forceSoftwareEncoder) {
|
|
9777
|
+
const isH264Cbp = (codecInfo) => {
|
|
9778
|
+
var _a;
|
|
9779
|
+
if (((_a = codecInfo.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'h264') {
|
|
9780
|
+
const profileLevelId = codecInfo.fmtParams.get('profile-level-id');
|
|
9781
|
+
return !!profileLevelId && /^42[^0]/.test(profileLevelId);
|
|
9782
|
+
}
|
|
9783
|
+
return false;
|
|
9784
|
+
};
|
|
9785
|
+
if ([...mediaDescription.codecs.values()].some(isH264Cbp)) {
|
|
9786
|
+
retainCodecs(mediaDescription, (codecInfo) => { var _a; return ((_a = codecInfo.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== 'h264' || isH264Cbp(codecInfo); });
|
|
9787
|
+
}
|
|
9788
|
+
else {
|
|
9789
|
+
logger.log(`No H.264 CBP present in m-line with MID ${mediaDescription.mid}, so all H.264 codecs have been retained.`);
|
|
9790
|
+
}
|
|
9791
|
+
}
|
|
9761
9792
|
if (mediaDescription.codecs.size === 0) {
|
|
9762
9793
|
logErrorAndThrow(WcmeErrorType.SDP_MUNGE_MISSING_CODECS, `No codecs present in m-line with MID ${mediaDescription.mid} after filtering.`);
|
|
9763
9794
|
}
|
|
@@ -9852,7 +9883,7 @@ class EgressSdpMunger {
|
|
|
9852
9883
|
}
|
|
9853
9884
|
}
|
|
9854
9885
|
mungeRemoteDescription(mediaDescription) {
|
|
9855
|
-
if (
|
|
9886
|
+
if (retainCandidatesByTransportType(mediaDescription, ['udp', 'tcp'])) {
|
|
9856
9887
|
logger.log(`Some unsupported remote candidates have been removed from mid ${mediaDescription.mid}`);
|
|
9857
9888
|
}
|
|
9858
9889
|
mediaDescription.bandwidth = undefined;
|
|
@@ -10365,7 +10396,7 @@ class IngressSdpMunger {
|
|
|
10365
10396
|
return Object.assign({ ssrc: this.ssrc }, (this.rtxSsrc ? { rtxSsrc: this.rtxSsrc } : {}));
|
|
10366
10397
|
}
|
|
10367
10398
|
mungeLocalDescription(mediaDescription, options) {
|
|
10368
|
-
|
|
10399
|
+
retainCodecsByCodecName(mediaDescription, ['h264', 'opus', 'rtx']);
|
|
10369
10400
|
if (mediaDescription.codecs.size === 0) {
|
|
10370
10401
|
logErrorAndThrow(WcmeErrorType.SDP_MUNGE_MISSING_CODECS, `No codecs present in m-line with MID ${mediaDescription.mid} after filtering.`);
|
|
10371
10402
|
}
|
|
@@ -10387,7 +10418,7 @@ class IngressSdpMunger {
|
|
|
10387
10418
|
mediaDescription.addLine(new SsrcGroupLine('FID', [this.ssrc, this.rtxSsrc]));
|
|
10388
10419
|
}
|
|
10389
10420
|
}
|
|
10390
|
-
if (
|
|
10421
|
+
if (retainCandidatesByTransportType(mediaDescription, ['udp', 'tcp'])) {
|
|
10391
10422
|
logger.log(`Some unsupported remote candidates have been removed from mid ${mediaDescription.mid}`);
|
|
10392
10423
|
}
|
|
10393
10424
|
[...mediaDescription.codecs.values()].forEach((ci) => {
|
|
@@ -14575,6 +14606,9 @@ class SendOnlyTransceiver extends Transceiver {
|
|
|
14575
14606
|
simulcastEnabled: this.isSimulcastEnabled(),
|
|
14576
14607
|
rtxEnabled: this.rtxEnabled,
|
|
14577
14608
|
twccDisabled: this.twccDisabled,
|
|
14609
|
+
forceSoftwareEncoder: this.mediaType === MediaType.VideoSlides &&
|
|
14610
|
+
(BrowserInfo.isWindows() || BrowserInfo.isMac()) &&
|
|
14611
|
+
(BrowserInfo.isChrome() || BrowserInfo.isEdge()),
|
|
14578
14612
|
});
|
|
14579
14613
|
}
|
|
14580
14614
|
mungeLocalDescriptionForRemoteServer(mediaDescription) {
|
|
@@ -15415,7 +15449,7 @@ SCTP Max Message Size: ${maxMessageSize}`);
|
|
|
15415
15449
|
parsedAnswer.media
|
|
15416
15450
|
.filter((media) => media instanceof ApplicationMediaDescription)
|
|
15417
15451
|
.forEach((media) => {
|
|
15418
|
-
if (
|
|
15452
|
+
if (retainCandidatesByTransportType(media, ['udp', 'tcp'])) {
|
|
15419
15453
|
logger.log(`Some unsupported remote candidates have been removed from mid ${media.mid}`);
|
|
15420
15454
|
}
|
|
15421
15455
|
});
|