@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/esm/index.js CHANGED
@@ -6654,23 +6654,6 @@ function areCodecInfosEqual(left, right) {
6654
6654
  return left.payloadType === right.payloadType && areH264CodecsEqual(left.h264, right.h264);
6655
6655
  }
6656
6656
 
6657
- var HomerMsgType;
6658
- (function (HomerMsgType) {
6659
- HomerMsgType["Multistream"] = "multistream";
6660
- })(HomerMsgType || (HomerMsgType = {}));
6661
- class HomerMsg {
6662
- constructor(msgType, payload) {
6663
- this.msgType = msgType;
6664
- this.payload = payload;
6665
- }
6666
- static fromJson(data) {
6667
- if (!data.msgType || !data.payload) {
6668
- return null;
6669
- }
6670
- return new HomerMsg(data.msgType, data.payload);
6671
- }
6672
- }
6673
-
6674
6657
  var JmpMsgType;
6675
6658
  (function (JmpMsgType) {
6676
6659
  JmpMsgType["MediaRequest"] = "mediaRequest";
@@ -6703,6 +6686,19 @@ function isValidJmpMsg(msg) {
6703
6686
  isValidJmpMsgPayload(maybeJmpMsg.payload));
6704
6687
  }
6705
6688
 
6689
+ class MediaRequestAckMsg {
6690
+ constructor(mediaRequestSeqNum) {
6691
+ this.mediaRequestSeqNum = mediaRequestSeqNum;
6692
+ }
6693
+ toString() {
6694
+ return `MediaRequestAckMsg(seqNum=${this.mediaRequestSeqNum})`;
6695
+ }
6696
+ }
6697
+ function isValidMediaRequestAckMsg(msg) {
6698
+ const maybeMediaRequestAckMsg = msg;
6699
+ return Boolean(maybeMediaRequestAckMsg.mediaRequestSeqNum);
6700
+ }
6701
+
6706
6702
  class MediaRequestMsg {
6707
6703
  constructor(seqNum, requests) {
6708
6704
  this.seqNum = seqNum;
@@ -6717,17 +6713,17 @@ function isValidMediaRequestMsg(msg) {
6717
6713
  return Boolean(maybeMediaRequestMsg.seqNum && maybeMediaRequestMsg.requests);
6718
6714
  }
6719
6715
 
6720
- class MediaRequestAckMsg {
6721
- constructor(mediaRequestSeqNum) {
6722
- this.mediaRequestSeqNum = mediaRequestSeqNum;
6716
+ class MediaRequestStatusAckMsg {
6717
+ constructor(mediaRequestStatusSeqNum) {
6718
+ this.mediaRequestStatusSeqNum = mediaRequestStatusSeqNum;
6723
6719
  }
6724
6720
  toString() {
6725
- return `MediaRequestAckMsg(seqNum=${this.mediaRequestSeqNum})`;
6721
+ return `MediaRequestStatusAckMsg(seqNum=${this.mediaRequestStatusSeqNum})`;
6726
6722
  }
6727
6723
  }
6728
- function isValidMediaRequestAckMsg(msg) {
6729
- const maybeMediaRequestAckMsg = msg;
6730
- return Boolean(maybeMediaRequestAckMsg.mediaRequestSeqNum);
6724
+ function isValidMediaRequestStatusAckMsg(msg) {
6725
+ const maybeMediaRequestStatusAckMsg = msg;
6726
+ return Boolean(maybeMediaRequestStatusAckMsg.mediaRequestStatusSeqNum);
6731
6727
  }
6732
6728
 
6733
6729
  function isValidMidRidStreamId(obj) {
@@ -6781,19 +6777,6 @@ function isValidMediaRequestStatusMsg(msg) {
6781
6777
  maybeMediaRequestStatusMsg.streamStates.every((streamInfo) => isValidStreamInfo(streamInfo)));
6782
6778
  }
6783
6779
 
6784
- class MediaRequestStatusAckMsg {
6785
- constructor(mediaRequestStatusSeqNum) {
6786
- this.mediaRequestStatusSeqNum = mediaRequestStatusSeqNum;
6787
- }
6788
- toString() {
6789
- return `MediaRequestStatusAckMsg(seqNum=${this.mediaRequestStatusSeqNum})`;
6790
- }
6791
- }
6792
- function isValidMediaRequestStatusAckMsg(msg) {
6793
- const maybeMediaRequestStatusAckMsg = msg;
6794
- return Boolean(maybeMediaRequestStatusAckMsg.mediaRequestStatusSeqNum);
6795
- }
6796
-
6797
6780
  class ReceiverSelectedInfo {
6798
6781
  constructor(csi) {
6799
6782
  this.csi = csi;
@@ -6826,6 +6809,19 @@ function arePolicySpecificInfosEqual(left, right) {
6826
6809
  throw new Error('Invalid PolicySpecificInfo');
6827
6810
  }
6828
6811
 
6812
+ class SourceAdvertisementAckMsg {
6813
+ constructor(sourceAdvertisementSeqNum) {
6814
+ this.sourceAdvertisementSeqNum = sourceAdvertisementSeqNum;
6815
+ }
6816
+ toString() {
6817
+ return `SourceAdvertisementAckMsg(sourceAdvertisementSeqNum=${this.sourceAdvertisementSeqNum})`;
6818
+ }
6819
+ }
6820
+ function isValidSourceAdvertisementAckMsg(msg) {
6821
+ const maybeSourceAdvertisementAckMsg = msg;
6822
+ return Boolean(maybeSourceAdvertisementAckMsg.sourceAdvertisementSeqNum);
6823
+ }
6824
+
6829
6825
  class SourceAdvertisementMsg {
6830
6826
  constructor(seqNum, numTotalSources, numLiveSources, namedMediaGroups, videoContentHint) {
6831
6827
  this.seqNum = seqNum;
@@ -6851,19 +6847,6 @@ function areSourceAdvertisementMsgsEqual(sourceAdvertisementMsg1, sourceAdvertis
6851
6847
  sourceAdvertisementMsg1.videoContentHint === sourceAdvertisementMsg2.videoContentHint);
6852
6848
  }
6853
6849
 
6854
- class SourceAdvertisementAckMsg {
6855
- constructor(sourceAdvertisementSeqNum) {
6856
- this.sourceAdvertisementSeqNum = sourceAdvertisementSeqNum;
6857
- }
6858
- toString() {
6859
- return `SourceAdvertisementAckMsg(sourceAdvertisementSeqNum=${this.sourceAdvertisementSeqNum})`;
6860
- }
6861
- }
6862
- function isValidSourceAdvertisementAckMsg(msg) {
6863
- const maybeSourceAdvertisementAckMsg = msg;
6864
- return Boolean(maybeSourceAdvertisementAckMsg.sourceAdvertisementSeqNum);
6865
- }
6866
-
6867
6850
  class StreamRequest$1 {
6868
6851
  constructor(policy, policySpecificInfo, ids, maxPayloadBitsPerSecond, codecInfos = []) {
6869
6852
  this.policy = policy;
@@ -7094,8 +7077,7 @@ class JmpSession extends EventEmitter$5 {
7094
7077
  msgType,
7095
7078
  payload,
7096
7079
  });
7097
- const homerMsg = new HomerMsg(HomerMsgType.Multistream, jmpMsg);
7098
- (_a = this.txCallback) === null || _a === void 0 ? void 0 : _a.call(this, JSON.stringify(homerMsg));
7080
+ (_a = this.txCallback) === null || _a === void 0 ? void 0 : _a.call(this, jmpMsg);
7099
7081
  }
7100
7082
  handleIncomingMediaRequest(mediaRequestMsg) {
7101
7083
  var _a;
@@ -7617,7 +7599,10 @@ function getFrameHeightByMaxFs(sourceAspectRatio, requestedMaxFs) {
7617
7599
  const _gcd = gcd(sourceAspectRatio[0], sourceAspectRatio[1]);
7618
7600
  const minNumberRatiosForWidth = sourceAspectRatio[0] / _gcd;
7619
7601
  const minNumberRatiosForHeight = sourceAspectRatio[1] / _gcd;
7620
- return (Math.floor(Math.sqrt((requestedMaxFs * 16 * 16) / (minNumberRatiosForWidth * minNumberRatiosForHeight))) * minNumberRatiosForHeight);
7602
+ const macroBlockSize = 16 * 16;
7603
+ const minRatioNumberByMaxFs = Math.sqrt((requestedMaxFs * macroBlockSize) / (minNumberRatiosForWidth * minNumberRatiosForHeight));
7604
+ const roundedMinRatioNumberByMaxFs = Math.max(Math.floor(minRatioNumberByMaxFs), 1.0);
7605
+ return roundedMinRatioNumberByMaxFs * minNumberRatiosForHeight;
7621
7606
  }
7622
7607
  function getScaleDownRatio(sourceWidth, sourceHeight, maxFs, maxWidth, maxHeight) {
7623
7608
  if (!sourceWidth || !sourceHeight || !maxFs) {
@@ -10510,6 +10495,23 @@ class IngressSdpMunger {
10510
10495
  }
10511
10496
  }
10512
10497
 
10498
+ var HomerMsgType;
10499
+ (function (HomerMsgType) {
10500
+ HomerMsgType["Multistream"] = "multistream";
10501
+ })(HomerMsgType || (HomerMsgType = {}));
10502
+ class HomerMsg {
10503
+ constructor(msgType, payload) {
10504
+ this.msgType = msgType;
10505
+ this.payload = payload;
10506
+ }
10507
+ static fromJson(data) {
10508
+ if (!data.msgType || !data.payload) {
10509
+ return null;
10510
+ }
10511
+ return new HomerMsg(data.msgType, data.payload);
10512
+ }
10513
+ }
10514
+
10513
10515
  class MidPredictor {
10514
10516
  constructor() {
10515
10517
  this.currentMid = 0;
@@ -15079,22 +15081,24 @@ class MultistreamConnection extends EventEmitter$2 {
15079
15081
  }
15080
15082
  createJmpSession(mediaType) {
15081
15083
  const jmpSession = new JmpSession(getMediaFamily(mediaType), getMediaContent(mediaType));
15082
- jmpSession.setTxCallback((msg) => {
15084
+ jmpSession.setTxCallback((jmpMessage) => {
15083
15085
  var _a;
15084
15086
  if (((_a = this.dataChannel) === null || _a === void 0 ? void 0 : _a.readyState) !== 'open') {
15085
15087
  logger.error(`DataChannel not created or not connected. Unable to send JMP message.`);
15086
15088
  return;
15087
15089
  }
15090
+ const homerMsg = new HomerMsg(HomerMsgType.Multistream, jmpMessage);
15091
+ const serializedHomerMsg = JSON.stringify(homerMsg);
15088
15092
  try {
15089
- logger.info(`Sending JMP message (size: ${msg.length}): ${msg}`);
15090
- this.dataChannel.send(msg);
15093
+ logger.info(`Sending JMP message: ${serializedHomerMsg}`);
15094
+ this.dataChannel.send(serializedHomerMsg);
15091
15095
  }
15092
15096
  catch (err) {
15093
15097
  const { bufferedAmount, readyState } = this.dataChannel;
15094
15098
  const { sctp } = this.pc.getUnderlyingRTCPeerConnection();
15095
15099
  const { maxMessageSize, state } = sctp || {};
15096
15100
  logErrorAndThrow(WcmeErrorType.DATA_CHANNEL_SEND_FAILED, `Sending JMP message failed with error: ${err},
15097
- Message size: ${msg.length},
15101
+ Message size: ${serializedHomerMsg.length},
15098
15102
  Data Channel State: ${readyState},
15099
15103
  Data Channel Buffered amount: ${bufferedAmount},
15100
15104
  SCTP State: ${state},