@webex/web-client-media-engine 1.40.6 → 1.40.8
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 +25 -20
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +25 -20
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +3 -3
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -15,7 +15,7 @@ function _mergeNamespaces(n, m) {
|
|
|
15
15
|
return Object.freeze(n);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
/******************************************************************************
|
|
19
19
|
Copyright (c) Microsoft Corporation.
|
|
20
20
|
|
|
21
21
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -328,8 +328,13 @@ var Logger$2 = logger$1$1.exports;
|
|
|
328
328
|
|
|
329
329
|
const DEFAULT_LOGGER_NAME$1 = 'webrtc-core';
|
|
330
330
|
const logger$3 = Logger$2.get(DEFAULT_LOGGER_NAME$1);
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
Logger$2.useDefaults({
|
|
332
|
+
defaultLevel: Logger$2.DEBUG,
|
|
333
|
+
/* eslint-disable-next-line jsdoc/require-jsdoc */
|
|
334
|
+
formatter: (messages, context) => {
|
|
335
|
+
messages.unshift(`[${context.name}]`);
|
|
336
|
+
},
|
|
337
|
+
});
|
|
333
338
|
|
|
334
339
|
var DeviceKind;
|
|
335
340
|
(function (DeviceKind) {
|
|
@@ -5232,7 +5237,7 @@ function getFrameHeightByMaxFs(sourceAspectRatio, requestedMaxFs) {
|
|
|
5232
5237
|
return (Math.floor(Math.sqrt((requestedMaxFs * 16 * 16) / (minNumberRatiosForWidth * minNumberRatiosForHeight))) * minNumberRatiosForHeight);
|
|
5233
5238
|
}
|
|
5234
5239
|
function getScaleDownRatio(sourceAspectRatio, sourceHeight, requestedMaxFs) {
|
|
5235
|
-
return sourceHeight / getFrameHeightByMaxFs(sourceAspectRatio, requestedMaxFs);
|
|
5240
|
+
return Math.max(sourceHeight / getFrameHeightByMaxFs(sourceAspectRatio, requestedMaxFs), 1.0);
|
|
5236
5241
|
}
|
|
5237
5242
|
function getRecommendedMaxBitrateForFrameSize(requestedMaxFs) {
|
|
5238
5243
|
if (requestedMaxFs < 60) {
|
|
@@ -9056,15 +9061,14 @@ class SendOnlyTransceiver extends Transceiver {
|
|
|
9056
9061
|
}
|
|
9057
9062
|
});
|
|
9058
9063
|
}
|
|
9059
|
-
|
|
9064
|
+
updateSendState(requestedIdEncodingParamsMap) {
|
|
9060
9065
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9061
9066
|
const sendParameters = this.sender.getParameters();
|
|
9062
9067
|
sendParameters.encodings.forEach((encoding, index) => {
|
|
9063
9068
|
const encodingParams = requestedIdEncodingParamsMap.get(index);
|
|
9064
9069
|
encoding.active = Boolean(encodingParams);
|
|
9065
9070
|
if (encodingParams) {
|
|
9066
|
-
if (encodingParams.scaleDownRatio
|
|
9067
|
-
encoding.scaleResolutionDownBy !== encodingParams.scaleDownRatio) {
|
|
9071
|
+
if (encodingParams.scaleDownRatio) {
|
|
9068
9072
|
encoding.scaleResolutionDownBy = encodingParams.scaleDownRatio;
|
|
9069
9073
|
}
|
|
9070
9074
|
if (encodingParams.maxPayloadBitsPerSecond) {
|
|
@@ -9075,21 +9079,22 @@ class SendOnlyTransceiver extends Transceiver {
|
|
|
9075
9079
|
yield this.sender.setParameters(sendParameters);
|
|
9076
9080
|
});
|
|
9077
9081
|
}
|
|
9078
|
-
getScaleDownRatio(
|
|
9082
|
+
getScaleDownRatio(maxFs, maxWidth, maxHeight) {
|
|
9079
9083
|
var _a;
|
|
9080
|
-
if (!
|
|
9081
|
-
return
|
|
9082
|
-
}
|
|
9083
|
-
if (!this.publishedTrack) {
|
|
9084
|
-
return -1;
|
|
9084
|
+
if (!this.publishedTrack || !maxFs) {
|
|
9085
|
+
return undefined;
|
|
9085
9086
|
}
|
|
9086
9087
|
const setting = (_a = this.publishedTrack) === null || _a === void 0 ? void 0 : _a.underlyingTrack.getSettings();
|
|
9087
9088
|
const sourceHeight = setting === null || setting === void 0 ? void 0 : setting.height;
|
|
9088
9089
|
const sourceWidth = setting === null || setting === void 0 ? void 0 : setting.width;
|
|
9089
9090
|
if (!sourceWidth || !sourceHeight) {
|
|
9090
|
-
return
|
|
9091
|
+
return undefined;
|
|
9092
|
+
}
|
|
9093
|
+
let scaleDownRatio = getScaleDownRatio([sourceWidth, sourceHeight], sourceHeight, maxFs);
|
|
9094
|
+
if (maxWidth && maxHeight) {
|
|
9095
|
+
scaleDownRatio = Math.max(sourceWidth / maxWidth, sourceHeight / maxHeight, scaleDownRatio);
|
|
9091
9096
|
}
|
|
9092
|
-
return
|
|
9097
|
+
return scaleDownRatio;
|
|
9093
9098
|
}
|
|
9094
9099
|
publishTrack(track) {
|
|
9095
9100
|
return this.replacePublishedTrack(track);
|
|
@@ -9725,6 +9730,7 @@ logger.setLevel(Logger.DEBUG);
|
|
|
9725
9730
|
function setLogLevel(level) {
|
|
9726
9731
|
logger.setLevel(level);
|
|
9727
9732
|
Logger$1.setLevel(level);
|
|
9733
|
+
Logger$2.setLevel(level);
|
|
9728
9734
|
}
|
|
9729
9735
|
function getLogLevel() {
|
|
9730
9736
|
return logger.getLevel();
|
|
@@ -9732,6 +9738,7 @@ function getLogLevel() {
|
|
|
9732
9738
|
function setLogHandler(logHandler) {
|
|
9733
9739
|
Logger.setHandler(logHandler);
|
|
9734
9740
|
Logger$1.setHandler(logHandler);
|
|
9741
|
+
Logger$2.setHandler(logHandler);
|
|
9735
9742
|
}
|
|
9736
9743
|
|
|
9737
9744
|
function toMediaStreamTrackKind(mediaType) {
|
|
@@ -9955,7 +9962,7 @@ class MultistreamConnection extends EventEmitter {
|
|
|
9955
9962
|
logger.warn('Ignoring non-receiver-selected requests');
|
|
9956
9963
|
}
|
|
9957
9964
|
rsRequests.forEach(({ ids, policySpecificInfo, codecInfos, maxPayloadBitsPerSecond }) => {
|
|
9958
|
-
var _a;
|
|
9965
|
+
var _a, _b, _c;
|
|
9959
9966
|
if (ids.length > 1) {
|
|
9960
9967
|
throw new Error(`More than a single ID being unexpected/invalid ${ids}`);
|
|
9961
9968
|
}
|
|
@@ -9975,7 +9982,7 @@ class MultistreamConnection extends EventEmitter {
|
|
|
9975
9982
|
const encodingIndex = signaler.getEncodingIndexForStreamId(id);
|
|
9976
9983
|
if (encodingIndex !== -1) {
|
|
9977
9984
|
requestedIdEncodingParamsMap.set(encodingIndex, {
|
|
9978
|
-
scaleDownRatio: sendTransceiver.getScaleDownRatio((_a = codecInfo === null || codecInfo === void 0 ? void 0 : codecInfo.h264) === null || _a === void 0 ? void 0 : _a.maxFs),
|
|
9985
|
+
scaleDownRatio: sendTransceiver.getScaleDownRatio((_a = codecInfo === null || codecInfo === void 0 ? void 0 : codecInfo.h264) === null || _a === void 0 ? void 0 : _a.maxFs, (_b = codecInfo === null || codecInfo === void 0 ? void 0 : codecInfo.h264) === null || _b === void 0 ? void 0 : _b.maxWidth, (_c = codecInfo === null || codecInfo === void 0 ? void 0 : codecInfo.h264) === null || _c === void 0 ? void 0 : _c.maxHeight),
|
|
9979
9986
|
maxPayloadBitsPerSecond,
|
|
9980
9987
|
});
|
|
9981
9988
|
}
|
|
@@ -9988,9 +9995,7 @@ class MultistreamConnection extends EventEmitter {
|
|
|
9988
9995
|
}
|
|
9989
9996
|
});
|
|
9990
9997
|
sendTransceiver.setTrackRequested(requestedIdEncodingParamsMap.size > 0);
|
|
9991
|
-
|
|
9992
|
-
sendTransceiver.updateSimulcastStreamStates(requestedIdEncodingParamsMap);
|
|
9993
|
-
}
|
|
9998
|
+
sendTransceiver.updateSendState(requestedIdEncodingParamsMap);
|
|
9994
9999
|
}
|
|
9995
10000
|
createDataChannel() {
|
|
9996
10001
|
const dataChannel = this.pc.createDataChannel('datachannel', {});
|