@webex/internal-media-core 1.38.3 → 1.38.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
@@ -6101,7 +6101,7 @@ FingerprintLine.regex = new RegExp("^fingerprint:(".concat(REST, ")"));
6101
6101
  function parseFmtpParams(fmtpParams) {
6102
6102
  fmtpParams = fmtpParams.replace(/^a=fmtp:\d+\x20/, '');
6103
6103
  var fmtpObj = new Map();
6104
- if (/^\d+([/-]\d+)+$/.test(fmtpParams)) {
6104
+ if (/^\d+([,/-]\d+)+$/.test(fmtpParams)) {
6105
6105
  fmtpObj.set(fmtpParams, undefined);
6106
6106
  return fmtpObj;
6107
6107
  }
@@ -6840,7 +6840,7 @@ class AvMediaDescription extends MediaDescription {
6840
6840
  constructor(mediaLine) {
6841
6841
  super(mediaLine.type, mediaLine.port, mediaLine.protocol);
6842
6842
  this.pts = [];
6843
- this.extMaps = [];
6843
+ this.extMaps = new Map();
6844
6844
  this.rids = [];
6845
6845
  this.codecs = new Map();
6846
6846
  this.rtcpMux = false;
@@ -6902,7 +6902,10 @@ class AvMediaDescription extends MediaDescription {
6902
6902
  return true;
6903
6903
  }
6904
6904
  if (line instanceof ExtMapLine) {
6905
- this.extMaps.push(line);
6905
+ if (this.extMaps.has(line.id)) {
6906
+ throw new Error("Tried to extension with duplicate ID: an extension already exists with ID ".concat(line.id));
6907
+ }
6908
+ this.extMaps.set(line.id, line);
6906
6909
  return true;
6907
6910
  }
6908
6911
  if (line instanceof RidLine) {
@@ -6947,6 +6950,32 @@ class AvMediaDescription extends MediaDescription {
6947
6950
  });
6948
6951
  this.pts = this.pts.filter(existingPt => allPtsToRemove.indexOf(existingPt) === -1);
6949
6952
  }
6953
+ addExtension(_ref) {
6954
+ var {
6955
+ uri,
6956
+ direction,
6957
+ attributes,
6958
+ id
6959
+ } = _ref;
6960
+ var getFirstFreeId = () => {
6961
+ var freeId = 1;
6962
+ for (;;) {
6963
+ if (!this.extMaps.has(freeId)) {
6964
+ break;
6965
+ }
6966
+ freeId += 1;
6967
+ }
6968
+ return freeId;
6969
+ };
6970
+ var extId = id || getFirstFreeId();
6971
+ if (this.extMaps.has(extId)) {
6972
+ throw new Error("Extension with ID ".concat(id, " already exists"));
6973
+ }
6974
+ if (extId === 0) {
6975
+ throw new Error("Extension ID 0 is reserved");
6976
+ }
6977
+ this.extMaps.set(extId, new ExtMapLine(extId, uri, direction, attributes));
6978
+ }
6950
6979
  }
6951
6980
  class SessionDescription {
6952
6981
  constructor() {
@@ -7223,7 +7252,7 @@ function addPeriodicKeyframes(sdp, value) {
7223
7252
  }
7224
7253
  function disableExtmap(sdp) {
7225
7254
  sdp.avMedia.forEach(media => {
7226
- media.extMaps.length = 0;
7255
+ media.extMaps.clear();
7227
7256
  });
7228
7257
  }
7229
7258
  function updateH264fmtpParams(sdp, paramsToUpdate) {
package/dist/esm/index.js CHANGED
@@ -6090,7 +6090,7 @@ FingerprintLine.regex = new RegExp("^fingerprint:(".concat(REST, ")"));
6090
6090
  function parseFmtpParams(fmtpParams) {
6091
6091
  fmtpParams = fmtpParams.replace(/^a=fmtp:\d+\x20/, '');
6092
6092
  var fmtpObj = new Map();
6093
- if (/^\d+([/-]\d+)+$/.test(fmtpParams)) {
6093
+ if (/^\d+([,/-]\d+)+$/.test(fmtpParams)) {
6094
6094
  fmtpObj.set(fmtpParams, undefined);
6095
6095
  return fmtpObj;
6096
6096
  }
@@ -6829,7 +6829,7 @@ class AvMediaDescription extends MediaDescription {
6829
6829
  constructor(mediaLine) {
6830
6830
  super(mediaLine.type, mediaLine.port, mediaLine.protocol);
6831
6831
  this.pts = [];
6832
- this.extMaps = [];
6832
+ this.extMaps = new Map();
6833
6833
  this.rids = [];
6834
6834
  this.codecs = new Map();
6835
6835
  this.rtcpMux = false;
@@ -6891,7 +6891,10 @@ class AvMediaDescription extends MediaDescription {
6891
6891
  return true;
6892
6892
  }
6893
6893
  if (line instanceof ExtMapLine) {
6894
- this.extMaps.push(line);
6894
+ if (this.extMaps.has(line.id)) {
6895
+ throw new Error("Tried to extension with duplicate ID: an extension already exists with ID ".concat(line.id));
6896
+ }
6897
+ this.extMaps.set(line.id, line);
6895
6898
  return true;
6896
6899
  }
6897
6900
  if (line instanceof RidLine) {
@@ -6936,6 +6939,32 @@ class AvMediaDescription extends MediaDescription {
6936
6939
  });
6937
6940
  this.pts = this.pts.filter(existingPt => allPtsToRemove.indexOf(existingPt) === -1);
6938
6941
  }
6942
+ addExtension(_ref) {
6943
+ var {
6944
+ uri,
6945
+ direction,
6946
+ attributes,
6947
+ id
6948
+ } = _ref;
6949
+ var getFirstFreeId = () => {
6950
+ var freeId = 1;
6951
+ for (;;) {
6952
+ if (!this.extMaps.has(freeId)) {
6953
+ break;
6954
+ }
6955
+ freeId += 1;
6956
+ }
6957
+ return freeId;
6958
+ };
6959
+ var extId = id || getFirstFreeId();
6960
+ if (this.extMaps.has(extId)) {
6961
+ throw new Error("Extension with ID ".concat(id, " already exists"));
6962
+ }
6963
+ if (extId === 0) {
6964
+ throw new Error("Extension ID 0 is reserved");
6965
+ }
6966
+ this.extMaps.set(extId, new ExtMapLine(extId, uri, direction, attributes));
6967
+ }
6939
6968
  }
6940
6969
  class SessionDescription {
6941
6970
  constructor() {
@@ -7212,7 +7241,7 @@ function addPeriodicKeyframes(sdp, value) {
7212
7241
  }
7213
7242
  function disableExtmap(sdp) {
7214
7243
  sdp.avMedia.forEach(media => {
7215
- media.extMaps.length = 0;
7244
+ media.extMaps.clear();
7216
7245
  });
7217
7246
  }
7218
7247
  function updateH264fmtpParams(sdp, paramsToUpdate) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/internal-media-core",
3
- "version": "1.38.3",
3
+ "version": "1.38.4",
4
4
  "files": [
5
5
  "dist/cjs",
6
6
  "dist/esm",
@@ -46,7 +46,7 @@
46
46
  "dependencies": {
47
47
  "@babel/runtime": "^7.18.9",
48
48
  "@webex/json-multistream": "2.0.1",
49
- "@webex/ts-sdp": "1.3.2",
49
+ "@webex/ts-sdp": "1.4.1",
50
50
  "@webex/web-client-media-engine": "2.1.3",
51
51
  "detectrtc": "^1.4.1",
52
52
  "events": "^3.3.0",