@webex/web-client-media-engine 2.0.5 → 2.0.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/cjs/index.js CHANGED
@@ -1130,6 +1130,7 @@ class LocalTrack extends EventEmitter$2 {
1130
1130
  constructor(stream) {
1131
1131
  super();
1132
1132
  this.isPublished = false;
1133
+ this.loadingEffects = new Map();
1133
1134
  this.effects = new Map();
1134
1135
  this.originalStream = stream;
1135
1136
  this.underlyingStream = stream;
@@ -1268,9 +1269,18 @@ class LocalTrack extends EventEmitter$2 {
1268
1269
  */
1269
1270
  addEffect(name, effect) {
1270
1271
  return __awaiter$1(this, void 0, void 0, function* () {
1272
+ // Load the effect
1273
+ this.loadingEffects.set(name, effect);
1271
1274
  yield effect.load(this.underlyingStream);
1275
+ // Check that the loaded effect is the latest one and dispose if not
1276
+ if (effect !== this.loadingEffects.get(name)) {
1277
+ yield effect.dispose();
1278
+ throw new Error(`Effect "${name}" not required after loading`);
1279
+ }
1280
+ // Use the loaded effect
1272
1281
  this.underlyingStream = effect.getUnderlyingStream();
1273
1282
  this.effects.set(name, effect);
1283
+ this.loadingEffects.delete(name);
1274
1284
  this.emit(exports.LocalTrackEvents.UnderlyingTrackChange);
1275
1285
  });
1276
1286
  }
@@ -1300,6 +1310,9 @@ class LocalTrack extends EventEmitter$2 {
1300
1310
  */
1301
1311
  disposeEffects() {
1302
1312
  return __awaiter$1(this, void 0, void 0, function* () {
1313
+ // Clear effects that are loading to indicate that they are not needed
1314
+ this.loadingEffects.clear();
1315
+ // Dispose of any effects currently in use
1303
1316
  if (this.effects.size > 0) {
1304
1317
  yield Promise.all(Array.from(this.effects.values(), (effect) => effect.dispose()));
1305
1318
  this.effects.clear();
@@ -1481,7 +1494,7 @@ class ConnectionStateHandler extends EventEmitter$2 {
1481
1494
  else {
1482
1495
  mediaConnectionState = exports.ConnectionState.Connecting;
1483
1496
  }
1484
- logger$3.log(`iceConnectionState=${iceState} connectionState=${connectionState} => ${this.mediaConnectionState}`);
1497
+ logger$3.log(`iceConnectionState=${iceState} connectionState=${connectionState} => ${mediaConnectionState}`);
1485
1498
  return mediaConnectionState;
1486
1499
  }
1487
1500
  /**
@@ -9192,7 +9205,9 @@ function injectJmpAttributes(parsedSdp, csiMap, streamSignalingMode) {
9192
9205
  function injectDummyCandidates(parsedSdp) {
9193
9206
  parsedSdp.media.forEach((mLine) => {
9194
9207
  if (mLine.iceInfo.candidates.length === 0) {
9195
- mLine.addLine(new CandidateLine('dummy', 1, 'udp', 1, '0.0.0.0', 1, 'host'));
9208
+ mLine.addLine(new CandidateLine('dummy1', 1, 'udp', 1, '0.0.0.0', 1, 'host'));
9209
+ mLine.addLine(new CandidateLine('dummy2', 2, 'tcp', 2, '0.0.0.0', 2, 'host'));
9210
+ mLine.addLine(new CandidateLine('dummy3', 3, 'udp', 3, '0.0.0.0', 3, 'relay'));
9196
9211
  }
9197
9212
  });
9198
9213
  }