@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/esm/index.js CHANGED
@@ -5232,7 +5232,7 @@ function getFrameHeightByMaxFs(sourceAspectRatio, requestedMaxFs) {
5232
5232
  return (Math.floor(Math.sqrt((requestedMaxFs * 16 * 16) / (minNumberRatiosForWidth * minNumberRatiosForHeight))) * minNumberRatiosForHeight);
5233
5233
  }
5234
5234
  function getScaleDownRatio(sourceAspectRatio, sourceHeight, requestedMaxFs) {
5235
- return sourceHeight / getFrameHeightByMaxFs(sourceAspectRatio, requestedMaxFs);
5235
+ return Math.max(sourceHeight / getFrameHeightByMaxFs(sourceAspectRatio, requestedMaxFs), 1.0);
5236
5236
  }
5237
5237
  function getRecommendedMaxBitrateForFrameSize(requestedMaxFs) {
5238
5238
  if (requestedMaxFs < 60) {
@@ -9075,9 +9075,9 @@ class SendOnlyTransceiver extends Transceiver {
9075
9075
  yield this.sender.setParameters(sendParameters);
9076
9076
  });
9077
9077
  }
9078
- getScaleDownRatio(expectedMaxFs) {
9078
+ getScaleDownRatio(maxFs, maxWidth, maxHeight) {
9079
9079
  var _a;
9080
- if (!expectedMaxFs) {
9080
+ if (!maxFs) {
9081
9081
  return -1;
9082
9082
  }
9083
9083
  if (!this.publishedTrack) {
@@ -9089,7 +9089,11 @@ class SendOnlyTransceiver extends Transceiver {
9089
9089
  if (!sourceWidth || !sourceHeight) {
9090
9090
  return -1;
9091
9091
  }
9092
- return Math.max(getScaleDownRatio([sourceWidth, sourceHeight], sourceHeight, expectedMaxFs), 1.0);
9092
+ let scaleDownRatio = getScaleDownRatio([sourceWidth, sourceHeight], sourceHeight, maxFs);
9093
+ if (maxWidth && maxHeight) {
9094
+ scaleDownRatio = Math.max(sourceWidth / maxWidth, sourceHeight / maxHeight, scaleDownRatio);
9095
+ }
9096
+ return scaleDownRatio;
9093
9097
  }
9094
9098
  publishTrack(track) {
9095
9099
  return this.replacePublishedTrack(track);
@@ -9955,7 +9959,7 @@ class MultistreamConnection extends EventEmitter {
9955
9959
  logger.warn('Ignoring non-receiver-selected requests');
9956
9960
  }
9957
9961
  rsRequests.forEach(({ ids, policySpecificInfo, codecInfos, maxPayloadBitsPerSecond }) => {
9958
- var _a;
9962
+ var _a, _b, _c;
9959
9963
  if (ids.length > 1) {
9960
9964
  throw new Error(`More than a single ID being unexpected/invalid ${ids}`);
9961
9965
  }
@@ -9975,7 +9979,7 @@ class MultistreamConnection extends EventEmitter {
9975
9979
  const encodingIndex = signaler.getEncodingIndexForStreamId(id);
9976
9980
  if (encodingIndex !== -1) {
9977
9981
  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),
9982
+ 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
9983
  maxPayloadBitsPerSecond,
9980
9984
  });
9981
9985
  }