@webex/web-client-media-engine 3.29.2 → 3.29.4

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
@@ -6658,23 +6658,6 @@ function areCodecInfosEqual(left, right) {
6658
6658
  return left.payloadType === right.payloadType && areH264CodecsEqual(left.h264, right.h264);
6659
6659
  }
6660
6660
 
6661
- var HomerMsgType;
6662
- (function (HomerMsgType) {
6663
- HomerMsgType["Multistream"] = "multistream";
6664
- })(HomerMsgType || (HomerMsgType = {}));
6665
- class HomerMsg {
6666
- constructor(msgType, payload) {
6667
- this.msgType = msgType;
6668
- this.payload = payload;
6669
- }
6670
- static fromJson(data) {
6671
- if (!data.msgType || !data.payload) {
6672
- return null;
6673
- }
6674
- return new HomerMsg(data.msgType, data.payload);
6675
- }
6676
- }
6677
-
6678
6661
  var JmpMsgType;
6679
6662
  (function (JmpMsgType) {
6680
6663
  JmpMsgType["MediaRequest"] = "mediaRequest";
@@ -6707,6 +6690,19 @@ function isValidJmpMsg(msg) {
6707
6690
  isValidJmpMsgPayload(maybeJmpMsg.payload));
6708
6691
  }
6709
6692
 
6693
+ class MediaRequestAckMsg {
6694
+ constructor(mediaRequestSeqNum) {
6695
+ this.mediaRequestSeqNum = mediaRequestSeqNum;
6696
+ }
6697
+ toString() {
6698
+ return `MediaRequestAckMsg(seqNum=${this.mediaRequestSeqNum})`;
6699
+ }
6700
+ }
6701
+ function isValidMediaRequestAckMsg(msg) {
6702
+ const maybeMediaRequestAckMsg = msg;
6703
+ return Boolean(maybeMediaRequestAckMsg.mediaRequestSeqNum);
6704
+ }
6705
+
6710
6706
  class MediaRequestMsg {
6711
6707
  constructor(seqNum, requests) {
6712
6708
  this.seqNum = seqNum;
@@ -6721,17 +6717,17 @@ function isValidMediaRequestMsg(msg) {
6721
6717
  return Boolean(maybeMediaRequestMsg.seqNum && maybeMediaRequestMsg.requests);
6722
6718
  }
6723
6719
 
6724
- class MediaRequestAckMsg {
6725
- constructor(mediaRequestSeqNum) {
6726
- this.mediaRequestSeqNum = mediaRequestSeqNum;
6720
+ class MediaRequestStatusAckMsg {
6721
+ constructor(mediaRequestStatusSeqNum) {
6722
+ this.mediaRequestStatusSeqNum = mediaRequestStatusSeqNum;
6727
6723
  }
6728
6724
  toString() {
6729
- return `MediaRequestAckMsg(seqNum=${this.mediaRequestSeqNum})`;
6725
+ return `MediaRequestStatusAckMsg(seqNum=${this.mediaRequestStatusSeqNum})`;
6730
6726
  }
6731
6727
  }
6732
- function isValidMediaRequestAckMsg(msg) {
6733
- const maybeMediaRequestAckMsg = msg;
6734
- return Boolean(maybeMediaRequestAckMsg.mediaRequestSeqNum);
6728
+ function isValidMediaRequestStatusAckMsg(msg) {
6729
+ const maybeMediaRequestStatusAckMsg = msg;
6730
+ return Boolean(maybeMediaRequestStatusAckMsg.mediaRequestStatusSeqNum);
6735
6731
  }
6736
6732
 
6737
6733
  function isValidMidRidStreamId(obj) {
@@ -6785,19 +6781,6 @@ function isValidMediaRequestStatusMsg(msg) {
6785
6781
  maybeMediaRequestStatusMsg.streamStates.every((streamInfo) => isValidStreamInfo(streamInfo)));
6786
6782
  }
6787
6783
 
6788
- class MediaRequestStatusAckMsg {
6789
- constructor(mediaRequestStatusSeqNum) {
6790
- this.mediaRequestStatusSeqNum = mediaRequestStatusSeqNum;
6791
- }
6792
- toString() {
6793
- return `MediaRequestStatusAckMsg(seqNum=${this.mediaRequestStatusSeqNum})`;
6794
- }
6795
- }
6796
- function isValidMediaRequestStatusAckMsg(msg) {
6797
- const maybeMediaRequestStatusAckMsg = msg;
6798
- return Boolean(maybeMediaRequestStatusAckMsg.mediaRequestStatusSeqNum);
6799
- }
6800
-
6801
6784
  class ReceiverSelectedInfo {
6802
6785
  constructor(csi) {
6803
6786
  this.csi = csi;
@@ -6830,6 +6813,19 @@ function arePolicySpecificInfosEqual(left, right) {
6830
6813
  throw new Error('Invalid PolicySpecificInfo');
6831
6814
  }
6832
6815
 
6816
+ class SourceAdvertisementAckMsg {
6817
+ constructor(sourceAdvertisementSeqNum) {
6818
+ this.sourceAdvertisementSeqNum = sourceAdvertisementSeqNum;
6819
+ }
6820
+ toString() {
6821
+ return `SourceAdvertisementAckMsg(sourceAdvertisementSeqNum=${this.sourceAdvertisementSeqNum})`;
6822
+ }
6823
+ }
6824
+ function isValidSourceAdvertisementAckMsg(msg) {
6825
+ const maybeSourceAdvertisementAckMsg = msg;
6826
+ return Boolean(maybeSourceAdvertisementAckMsg.sourceAdvertisementSeqNum);
6827
+ }
6828
+
6833
6829
  class SourceAdvertisementMsg {
6834
6830
  constructor(seqNum, numTotalSources, numLiveSources, namedMediaGroups, videoContentHint) {
6835
6831
  this.seqNum = seqNum;
@@ -6855,19 +6851,6 @@ function areSourceAdvertisementMsgsEqual(sourceAdvertisementMsg1, sourceAdvertis
6855
6851
  sourceAdvertisementMsg1.videoContentHint === sourceAdvertisementMsg2.videoContentHint);
6856
6852
  }
6857
6853
 
6858
- class SourceAdvertisementAckMsg {
6859
- constructor(sourceAdvertisementSeqNum) {
6860
- this.sourceAdvertisementSeqNum = sourceAdvertisementSeqNum;
6861
- }
6862
- toString() {
6863
- return `SourceAdvertisementAckMsg(sourceAdvertisementSeqNum=${this.sourceAdvertisementSeqNum})`;
6864
- }
6865
- }
6866
- function isValidSourceAdvertisementAckMsg(msg) {
6867
- const maybeSourceAdvertisementAckMsg = msg;
6868
- return Boolean(maybeSourceAdvertisementAckMsg.sourceAdvertisementSeqNum);
6869
- }
6870
-
6871
6854
  class StreamRequest$1 {
6872
6855
  constructor(policy, policySpecificInfo, ids, maxPayloadBitsPerSecond, codecInfos = []) {
6873
6856
  this.policy = policy;
@@ -7098,8 +7081,7 @@ class JmpSession extends events$3.EventEmitter {
7098
7081
  msgType,
7099
7082
  payload,
7100
7083
  });
7101
- const homerMsg = new HomerMsg(HomerMsgType.Multistream, jmpMsg);
7102
- (_a = this.txCallback) === null || _a === void 0 ? void 0 : _a.call(this, JSON.stringify(homerMsg));
7084
+ (_a = this.txCallback) === null || _a === void 0 ? void 0 : _a.call(this, jmpMsg);
7103
7085
  }
7104
7086
  handleIncomingMediaRequest(mediaRequestMsg) {
7105
7087
  var _a;
@@ -7621,7 +7603,10 @@ function getFrameHeightByMaxFs(sourceAspectRatio, requestedMaxFs) {
7621
7603
  const _gcd = gcd(sourceAspectRatio[0], sourceAspectRatio[1]);
7622
7604
  const minNumberRatiosForWidth = sourceAspectRatio[0] / _gcd;
7623
7605
  const minNumberRatiosForHeight = sourceAspectRatio[1] / _gcd;
7624
- return (Math.floor(Math.sqrt((requestedMaxFs * 16 * 16) / (minNumberRatiosForWidth * minNumberRatiosForHeight))) * minNumberRatiosForHeight);
7606
+ const macroBlockSize = 16 * 16;
7607
+ const minRatioNumberByMaxFs = Math.sqrt((requestedMaxFs * macroBlockSize) / (minNumberRatiosForWidth * minNumberRatiosForHeight));
7608
+ const roundedMinRatioNumberByMaxFs = Math.max(Math.floor(minRatioNumberByMaxFs), 1.0);
7609
+ return roundedMinRatioNumberByMaxFs * minNumberRatiosForHeight;
7625
7610
  }
7626
7611
  function getScaleDownRatio(sourceWidth, sourceHeight, maxFs, maxWidth, maxHeight) {
7627
7612
  if (!sourceWidth || !sourceHeight || !maxFs) {
@@ -10514,6 +10499,23 @@ class IngressSdpMunger {
10514
10499
  }
10515
10500
  }
10516
10501
 
10502
+ var HomerMsgType;
10503
+ (function (HomerMsgType) {
10504
+ HomerMsgType["Multistream"] = "multistream";
10505
+ })(HomerMsgType || (HomerMsgType = {}));
10506
+ class HomerMsg {
10507
+ constructor(msgType, payload) {
10508
+ this.msgType = msgType;
10509
+ this.payload = payload;
10510
+ }
10511
+ static fromJson(data) {
10512
+ if (!data.msgType || !data.payload) {
10513
+ return null;
10514
+ }
10515
+ return new HomerMsg(data.msgType, data.payload);
10516
+ }
10517
+ }
10518
+
10517
10519
  class MidPredictor {
10518
10520
  constructor() {
10519
10521
  this.currentMid = 0;
@@ -15083,22 +15085,24 @@ class MultistreamConnection extends EventEmitter$2 {
15083
15085
  }
15084
15086
  createJmpSession(mediaType) {
15085
15087
  const jmpSession = new JmpSession(getMediaFamily(mediaType), getMediaContent(mediaType));
15086
- jmpSession.setTxCallback((msg) => {
15088
+ jmpSession.setTxCallback((jmpMessage) => {
15087
15089
  var _a;
15088
15090
  if (((_a = this.dataChannel) === null || _a === void 0 ? void 0 : _a.readyState) !== 'open') {
15089
15091
  logger.error(`DataChannel not created or not connected. Unable to send JMP message.`);
15090
15092
  return;
15091
15093
  }
15094
+ const homerMsg = new HomerMsg(HomerMsgType.Multistream, jmpMessage);
15095
+ const serializedHomerMsg = JSON.stringify(homerMsg);
15092
15096
  try {
15093
- logger.info(`Sending JMP message (size: ${msg.length}): ${msg}`);
15094
- this.dataChannel.send(msg);
15097
+ logger.info(`Sending JMP message: ${serializedHomerMsg}`);
15098
+ this.dataChannel.send(serializedHomerMsg);
15095
15099
  }
15096
15100
  catch (err) {
15097
15101
  const { bufferedAmount, readyState } = this.dataChannel;
15098
15102
  const { sctp } = this.pc.getUnderlyingRTCPeerConnection();
15099
15103
  const { maxMessageSize, state } = sctp || {};
15100
15104
  logErrorAndThrow(exports.WcmeErrorType.DATA_CHANNEL_SEND_FAILED, `Sending JMP message failed with error: ${err},
15101
- Message size: ${msg.length},
15105
+ Message size: ${serializedHomerMsg.length},
15102
15106
  Data Channel State: ${readyState},
15103
15107
  Data Channel Buffered amount: ${bufferedAmount},
15104
15108
  SCTP State: ${state},