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