@webex/web-client-media-engine 3.22.0 → 3.22.2

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
@@ -9747,9 +9747,10 @@ function generateSsrc() {
9747
9747
  }
9748
9748
 
9749
9749
  class EgressSdpMunger {
9750
- constructor() {
9750
+ constructor(options) {
9751
9751
  this.streamIds = [];
9752
9752
  this.customCodecParameters = new Map();
9753
+ this.egressMungerOptions = options;
9753
9754
  }
9754
9755
  reset() {
9755
9756
  this.streamIds = [];
@@ -9838,7 +9839,9 @@ class EgressSdpMunger {
9838
9839
  mungeLocalDescriptionForRemoteServer(mediaDescription, mediaContent, csi) {
9839
9840
  injectContentType(mediaDescription, mediaContent);
9840
9841
  injectJmpAttributes(mediaDescription, csi, 'SSRC');
9841
- injectDummyCandidates(mediaDescription);
9842
+ if (!this.egressMungerOptions.doFullIce) {
9843
+ injectDummyCandidates(mediaDescription);
9844
+ }
9842
9845
  if (mediaDescription.type === 'video') {
9843
9846
  const ssrcGroup = mediaDescription.ssrcGroups.find((sg) => sg.semantics === 'SIM');
9844
9847
  if (ssrcGroup) {
@@ -10476,7 +10479,7 @@ class ReceiveSlot extends EventEmitter$2 {
10476
10479
  this.handleStreamMediaStateChange = this.handleStreamMediaStateChange.bind(this);
10477
10480
  this.handleStreamEnded = this.handleStreamEnded.bind(this);
10478
10481
  this._stream = new RemoteStream(new MediaStream([track]));
10479
- this._sourceState = 'no source';
10482
+ this._sourceState = track.kind === MediaStreamTrackKind.Video ? 'no source' : undefined;
10480
10483
  this._stream.on(RemoteStreamEventNames.MediaStateChange, this.handleStreamMediaStateChange);
10481
10484
  this._stream.on(StreamEventNames.Ended, this.handleStreamEnded);
10482
10485
  }
@@ -10514,6 +10517,9 @@ class ReceiveSlot extends EventEmitter$2 {
10514
10517
  get currentRxCsi() {
10515
10518
  return this._currentRxCsi;
10516
10519
  }
10520
+ get sourceState() {
10521
+ return this._sourceState;
10522
+ }
10517
10523
  }
10518
10524
  ReceiveSlot.Events = ReceiveSlotEvents;
10519
10525
 
@@ -10587,6 +10593,7 @@ class ReceiveOnlyTransceiver extends Transceiver {
10587
10593
  if (stats.type === 'inbound-rtp') {
10588
10594
  stats.mid = this.mid;
10589
10595
  stats.csi = this.receiveSlot.currentRxCsi;
10596
+ stats.sourceState = this.receiveSlot.sourceState;
10590
10597
  stats.calliopeMediaType = this.metadata.mediaType;
10591
10598
  stats.requestedBitrate = this.metadata.requestedBitrate;
10592
10599
  stats.requestedFrameSize = this.metadata.requestedFrameSize;
@@ -14749,6 +14756,7 @@ const defaultMultistreamConnectionOptions = {
14749
14756
  iceServers: undefined,
14750
14757
  disableContentSimulcast: true,
14751
14758
  disableAudioTwcc: true,
14759
+ doFullIce: BrowserInfo.isFirefox(),
14752
14760
  };
14753
14761
  class MultistreamConnection extends EventEmitter$2 {
14754
14762
  constructor(userOptions = {}) {
@@ -14855,7 +14863,9 @@ class MultistreamConnection extends EventEmitter$2 {
14855
14863
  }
14856
14864
  const mid = this.midPredictor.getNextMid(mediaType);
14857
14865
  const csi = generateCsi(getMediaFamily(mediaType), sceneId);
14858
- const munger = new EgressSdpMunger();
14866
+ const munger = new EgressSdpMunger({
14867
+ doFullIce: this.options.doFullIce,
14868
+ });
14859
14869
  const transceiver = new SendOnlyTransceiver(rtcTransceiver, mid, csi, munger, mediaType);
14860
14870
  if (getMediaFamily(mediaType) === MediaFamily.Video) {
14861
14871
  transceiver.rtxEnabled = true;
@@ -15213,6 +15223,22 @@ SCTP Max Message Size: ${maxMessageSize}`);
15213
15223
  }
15214
15224
  return targetCodec.pt;
15215
15225
  }
15226
+ waitForIceGatheringComplete() {
15227
+ return __awaiter$1(this, void 0, void 0, function* () {
15228
+ return new Promise((resolve) => {
15229
+ if (this.pc.iceGatheringState === 'complete') {
15230
+ resolve();
15231
+ }
15232
+ else {
15233
+ this.pc.on(PeerConnection.Events.IceGatheringStateChange, () => {
15234
+ if (this.pc.iceGatheringState === 'complete') {
15235
+ resolve();
15236
+ }
15237
+ });
15238
+ }
15239
+ });
15240
+ });
15241
+ }
15216
15242
  createOffer() {
15217
15243
  return __awaiter$1(this, void 0, void 0, function* () {
15218
15244
  if (!this.pc.getLocalDescription()) {
@@ -15242,6 +15268,9 @@ SCTP Max Message Size: ${maxMessageSize}`);
15242
15268
  var _a;
15243
15269
  logErrorAndThrow(WcmeErrorType.CREATE_OFFER_FAILED, `Error: ${error}. SDP: ${maskIp((_a = offer.sdp) !== null && _a !== void 0 ? _a : '')}`);
15244
15270
  });
15271
+ if (this.options.doFullIce) {
15272
+ yield this.waitForIceGatheringComplete();
15273
+ }
15245
15274
  const sdpToSend = this.prepareLocalOfferForRemoteServer((_a = this.pc.getLocalDescription()) === null || _a === void 0 ? void 0 : _a.sdp);
15246
15275
  createOfferResolve({ type: 'offer', sdp: sdpToSend });
15247
15276
  if (this.currentCreateOfferId > createOfferId) {
@@ -15346,11 +15375,13 @@ SCTP Max Message Size: ${maxMessageSize}`);
15346
15375
  const sendTransceiver = this.getSendTransceiverByMidOrThrow(av.mid);
15347
15376
  sendTransceiver.mungeLocalDescriptionForRemoteServer(av);
15348
15377
  });
15349
- parsedOffer.media
15350
- .filter((media) => media instanceof ApplicationMediaDescription)
15351
- .forEach((media) => {
15352
- injectDummyCandidates(media);
15353
- });
15378
+ if (!this.options.doFullIce) {
15379
+ parsedOffer.media
15380
+ .filter((media) => media instanceof ApplicationMediaDescription)
15381
+ .forEach((media) => {
15382
+ injectDummyCandidates(media);
15383
+ });
15384
+ }
15354
15385
  if (BrowserInfo.isFirefox()) {
15355
15386
  setupBundle(parsedOffer, this.options.bundlePolicy, this.midPredictor.getMidMap());
15356
15387
  if (this.options.bundlePolicy === 'max-bundle') {