@webex/web-client-media-engine 1.40.6 → 1.40.7

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 CHANGED
@@ -5236,7 +5236,7 @@ function getFrameHeightByMaxFs(sourceAspectRatio, requestedMaxFs) {
5236
5236
  return (Math.floor(Math.sqrt((requestedMaxFs * 16 * 16) / (minNumberRatiosForWidth * minNumberRatiosForHeight))) * minNumberRatiosForHeight);
5237
5237
  }
5238
5238
  function getScaleDownRatio(sourceAspectRatio, sourceHeight, requestedMaxFs) {
5239
- return sourceHeight / getFrameHeightByMaxFs(sourceAspectRatio, requestedMaxFs);
5239
+ return Math.max(sourceHeight / getFrameHeightByMaxFs(sourceAspectRatio, requestedMaxFs), 1.0);
5240
5240
  }
5241
5241
  function getRecommendedMaxBitrateForFrameSize(requestedMaxFs) {
5242
5242
  if (requestedMaxFs < 60) {
@@ -9079,9 +9079,9 @@ class SendOnlyTransceiver extends Transceiver {
9079
9079
  yield this.sender.setParameters(sendParameters);
9080
9080
  });
9081
9081
  }
9082
- getScaleDownRatio(expectedMaxFs) {
9082
+ getScaleDownRatio(maxFs, maxWidth, maxHeight) {
9083
9083
  var _a;
9084
- if (!expectedMaxFs) {
9084
+ if (!maxFs) {
9085
9085
  return -1;
9086
9086
  }
9087
9087
  if (!this.publishedTrack) {
@@ -9093,7 +9093,11 @@ class SendOnlyTransceiver extends Transceiver {
9093
9093
  if (!sourceWidth || !sourceHeight) {
9094
9094
  return -1;
9095
9095
  }
9096
- return Math.max(getScaleDownRatio([sourceWidth, sourceHeight], sourceHeight, expectedMaxFs), 1.0);
9096
+ let scaleDownRatio = getScaleDownRatio([sourceWidth, sourceHeight], sourceHeight, maxFs);
9097
+ if (maxWidth && maxHeight) {
9098
+ scaleDownRatio = Math.max(sourceWidth / maxWidth, sourceHeight / maxHeight, scaleDownRatio);
9099
+ }
9100
+ return scaleDownRatio;
9097
9101
  }
9098
9102
  publishTrack(track) {
9099
9103
  return this.replacePublishedTrack(track);
@@ -9959,7 +9963,7 @@ class MultistreamConnection extends EventEmitter {
9959
9963
  logger.warn('Ignoring non-receiver-selected requests');
9960
9964
  }
9961
9965
  rsRequests.forEach(({ ids, policySpecificInfo, codecInfos, maxPayloadBitsPerSecond }) => {
9962
- var _a;
9966
+ var _a, _b, _c;
9963
9967
  if (ids.length > 1) {
9964
9968
  throw new Error(`More than a single ID being unexpected/invalid ${ids}`);
9965
9969
  }
@@ -9979,7 +9983,7 @@ class MultistreamConnection extends EventEmitter {
9979
9983
  const encodingIndex = signaler.getEncodingIndexForStreamId(id);
9980
9984
  if (encodingIndex !== -1) {
9981
9985
  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),
9986
+ 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
9987
  maxPayloadBitsPerSecond,
9984
9988
  });
9985
9989
  }