@webex/web-client-media-engine 1.34.4 → 1.34.6

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
@@ -5777,7 +5777,7 @@ class JmpSession extends events$2.EventEmitter {
5777
5777
  }
5778
5778
 
5779
5779
  class MediaRequest {
5780
- constructor(policy, policySpecificInfo, receiveSlots, maxPayloadBitsPerSecond, codecInfos) {
5780
+ constructor(policy, policySpecificInfo, receiveSlots, maxPayloadBitsPerSecond, codecInfos = []) {
5781
5781
  this.policy = policy;
5782
5782
  this.policySpecificInfo = policySpecificInfo;
5783
5783
  this.receiveSlots = receiveSlots;
@@ -6859,6 +6859,22 @@ class FingerprintLine extends Line {
6859
6859
  }
6860
6860
  FingerprintLine.regex = new RegExp(`^fingerprint:(${REST})`);
6861
6861
 
6862
+ function parseFmtpParams(fmtpParams) {
6863
+ fmtpParams = fmtpParams.replace(/^a=fmtp:\d+\x20/, '');
6864
+ const fmtpObj = new Map();
6865
+ if (/^\d+([/-]\d+)+$/.test(fmtpParams)) {
6866
+ fmtpObj.set(fmtpParams, undefined);
6867
+ return fmtpObj;
6868
+ }
6869
+ fmtpParams.split(';').forEach((param) => {
6870
+ const paramArr = param && param.split('=');
6871
+ if (paramArr.length !== 2 || !paramArr[0] || !paramArr[1]) {
6872
+ throw new Error(`Fmtp params is invalid with ${fmtpParams}`);
6873
+ }
6874
+ fmtpObj.set(paramArr[0], paramArr[1]);
6875
+ });
6876
+ return fmtpObj;
6877
+ }
6862
6878
  class FmtpLine extends Line {
6863
6879
  constructor(payloadType, params) {
6864
6880
  super();
@@ -6872,10 +6888,18 @@ class FmtpLine extends Line {
6872
6888
  const tokens = line.match(FmtpLine.regex);
6873
6889
  const payloadType = parseInt(tokens[1], 10);
6874
6890
  const params = tokens[2];
6875
- return new FmtpLine(payloadType, params);
6891
+ return new FmtpLine(payloadType, parseFmtpParams(params));
6876
6892
  }
6877
6893
  toSdpLine() {
6878
- return `a=fmtp:${this.payloadType} ${this.params}`;
6894
+ const fmtParams = Array.from(this.params.keys())
6895
+ .map((key) => {
6896
+ if (this.params.get(key) !== undefined) {
6897
+ return `${key}=${this.params.get(key)}`;
6898
+ }
6899
+ return `${key}`;
6900
+ })
6901
+ .join(';');
6902
+ return `a=fmtp:${this.payloadType} ${fmtParams}`;
6879
6903
  }
6880
6904
  }
6881
6905
  FmtpLine.regex = new RegExp(`^fmtp:(${NUM}) (${REST})`);
@@ -7562,7 +7586,7 @@ class ApplicationMediaDescription extends MediaDescription {
7562
7586
 
7563
7587
  class CodecInfo {
7564
7588
  constructor(pt) {
7565
- this.fmtParams = [];
7589
+ this.fmtParams = new Map();
7566
7590
  this.feedback = [];
7567
7591
  this.pt = pt;
7568
7592
  }
@@ -7574,9 +7598,12 @@ class CodecInfo {
7574
7598
  return true;
7575
7599
  }
7576
7600
  if (line instanceof FmtpLine) {
7577
- this.fmtParams.push(line.params);
7578
- if (line.params.indexOf('apt') !== -1) {
7579
- const apt = line.params.split('=')[1];
7601
+ this.fmtParams = new Map([
7602
+ ...Array.from(this.fmtParams.entries()),
7603
+ ...Array.from(line.params.entries()),
7604
+ ]);
7605
+ if (line.params.has('apt')) {
7606
+ const apt = line.params.get('apt');
7580
7607
  this.primaryCodecPt = parseInt(apt, 10);
7581
7608
  }
7582
7609
  return true;
@@ -7593,9 +7620,9 @@ class CodecInfo {
7593
7620
  this.feedback.forEach((fb) => {
7594
7621
  lines.push(new RtcpFbLine(this.pt, fb));
7595
7622
  });
7596
- this.fmtParams.forEach((fmt) => {
7597
- lines.push(new FmtpLine(this.pt, fmt));
7598
- });
7623
+ if (this.fmtParams.size > 0) {
7624
+ lines.push(new FmtpLine(this.pt, this.fmtParams));
7625
+ }
7599
7626
  return lines;
7600
7627
  }
7601
7628
  }
@@ -7941,18 +7968,6 @@ const maxFrameSizeToMaxBitrateMap = new Map([
7941
7968
  [3600, 2500000],
7942
7969
  [8160, 4000000],
7943
7970
  ]);
7944
- function parseFmtpParams(fmtpParams) {
7945
- fmtpParams = fmtpParams.replace(/^a=fmtp:\d+\x20/, '');
7946
- const fmtpObj = {};
7947
- fmtpParams.split(';').forEach((param) => {
7948
- const paramArr = param && param.split('=');
7949
- if (paramArr.length !== 2 || !paramArr[0] || !paramArr[1]) {
7950
- throw new Error(`Fmtp params is invalid with ${fmtpParams}`);
7951
- }
7952
- fmtpObj[paramArr[0]] = paramArr[1];
7953
- });
7954
- return fmtpObj;
7955
- }
7956
7971
  function areProfileLevelIdsCompatible(senderProfileLevelId, receiverProfileLevelId, levelAsymmetryAllowed) {
7957
7972
  const senderProfile = Number.parseInt(`0x${senderProfileLevelId}`, 16);
7958
7973
  const recvProfile = Number.parseInt(`0x${receiverProfileLevelId}`, 16);
@@ -7980,8 +7995,8 @@ function areCodecsCompatible(senderCodec, receiverCodec) {
7980
7995
  return true;
7981
7996
  }
7982
7997
  if (key === 'sdpFmtpLine') {
7983
- const fmtpForSender = parseFmtpParams(senderCodec[key]);
7984
- const fmtpForReceiver = parseFmtpParams(receiverCodec[key]);
7998
+ const fmtpForSender = Object.fromEntries(parseFmtpParams(senderCodec[key]));
7999
+ const fmtpForReceiver = Object.fromEntries(parseFmtpParams(receiverCodec[key]));
7985
8000
  const levelAsymmetryAllowed = Object.keys(fmtpForSender).some((senderFmtpParamKey) => {
7986
8001
  return (senderFmtpParamKey === 'level-asymmetry-allowed' &&
7987
8002
  fmtpForReceiver[senderFmtpParamKey] === '1' &&
@@ -8795,7 +8810,7 @@ function matchMlinesInAnswer(parsedOffer, parsedAnswer, streamSignalerManager) {
8795
8810
  if (answerMline) {
8796
8811
  if (answerMline instanceof AvMediaDescription) {
8797
8812
  [...answerMline.codecs.values()].forEach((ci) => {
8798
- ci.fmtParams.push('x-google-start-bitrate=60000');
8813
+ ci.fmtParams.set('x-google-start-bitrate', '60000');
8799
8814
  });
8800
8815
  }
8801
8816
  return answerMline;
@@ -9049,7 +9064,7 @@ class RidEgressStreamSignaler {
9049
9064
  }
9050
9065
 
9051
9066
  function generateSsrc() {
9052
- return Math.floor(Math.random() * 0xffffffff);
9067
+ return Math.floor(Math.random() * 0xffffffff) + 1;
9053
9068
  }
9054
9069
 
9055
9070
  class SsrcIngressStreamSignaler {
@@ -9929,8 +9944,8 @@ class MultistreamConnection extends EventEmitter {
9929
9944
  [...av.codecs.values()]
9930
9945
  .filter((ci) => ci.name === 'H264')
9931
9946
  .forEach((ci) => {
9932
- ci.fmtParams.push(`max-mbps=${defaultMaxVideoEncodeMbps}`);
9933
- ci.fmtParams.push(`max-fs=${defaultMaxVideoEncodeFrameSize}`);
9947
+ ci.fmtParams.set('max-mbps', `${defaultMaxVideoEncodeMbps}`);
9948
+ ci.fmtParams.set('max-fs', `${defaultMaxVideoEncodeFrameSize}`);
9934
9949
  });
9935
9950
  }
9936
9951
  });