@webex/web-client-media-engine 3.30.1 → 3.30.3

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
@@ -10592,6 +10592,7 @@ exports.ReceiveSlotEvents = void 0;
10592
10592
  class ReceiveSlot extends EventEmitter$2 {
10593
10593
  constructor(idGetter, track) {
10594
10594
  super();
10595
+ this._isRequested = false;
10595
10596
  this._idGetter = idGetter;
10596
10597
  this.handleStreamMediaStateChange = this.handleStreamMediaStateChange.bind(this);
10597
10598
  this.handleStreamEnded = this.handleStreamEnded.bind(this);
@@ -10694,7 +10695,7 @@ class Transceiver {
10694
10695
  class ReceiveOnlyTransceiver extends Transceiver {
10695
10696
  constructor(config) {
10696
10697
  super(config);
10697
- this.metadata = { isRequested: false, isActiveSpeaker: false };
10698
+ this.metadata = { isActiveSpeaker: false };
10698
10699
  this.munger = config.munger;
10699
10700
  this._receiveSlot = new ReceiveSlot(() => {
10700
10701
  if (!this._rtcRtpTransceiver.mid) {
@@ -10727,7 +10728,7 @@ class ReceiveOnlyTransceiver extends Transceiver {
10727
10728
  stats.requestedBitrate = this.metadata.requestedBitrate;
10728
10729
  stats.requestedFrameSize = this.metadata.requestedFrameSize;
10729
10730
  stats.requestedFrameRate = this.metadata.requestedFrameRate;
10730
- stats.isRequested = this.metadata.isRequested;
10731
+ stats.isRequested = this.receiveSlot._isRequested;
10731
10732
  stats.lastRequestedUpdateTimestamp = this.metadata.lastRequestedUpdateTimestamp;
10732
10733
  stats.isActiveSpeaker = this.metadata.isActiveSpeaker;
10733
10734
  stats.lastActiveSpeakerUpdateTimestamp = this.metadata.lastActiveSpeakerUpdateTimestamp;
@@ -10754,8 +10755,8 @@ class ReceiveOnlyTransceiver extends Transceiver {
10754
10755
  }
10755
10756
  handleRequested(streamRequest) {
10756
10757
  var _a, _b, _c, _d;
10757
- if (!this.metadata.isRequested) {
10758
- this.metadata.isRequested = true;
10758
+ if (!this.receiveSlot._isRequested) {
10759
+ this.receiveSlot._isRequested = true;
10759
10760
  this.metadata.lastRequestedUpdateTimestamp = getCurrentTimestamp();
10760
10761
  }
10761
10762
  this.metadata.requestedBitrate = streamRequest.maxPayloadBitsPerSecond;
@@ -10763,8 +10764,8 @@ class ReceiveOnlyTransceiver extends Transceiver {
10763
10764
  this.metadata.requestedFrameRate = (_d = (_c = streamRequest.codecInfos[0]) === null || _c === void 0 ? void 0 : _c.h264) === null || _d === void 0 ? void 0 : _d.maxFps;
10764
10765
  }
10765
10766
  handleUnrequested() {
10766
- if (this.metadata.isRequested) {
10767
- this.metadata.isRequested = false;
10767
+ if (this.receiveSlot._isRequested) {
10768
+ this.receiveSlot._isRequested = false;
10768
10769
  this.metadata.lastRequestedUpdateTimestamp = getCurrentTimestamp();
10769
10770
  }
10770
10771
  this.metadata.requestedBitrate = undefined;
@@ -14924,6 +14925,7 @@ const defaultMultistreamConnectionOptions = {
14924
14925
  disableContentSimulcast: true,
14925
14926
  disableAudioTwcc: true,
14926
14927
  doFullIce: BrowserInfo.isFirefox(),
14928
+ stopIceGatheringAfterFirstRelayCandidate: false,
14927
14929
  metricsCallback: () => { },
14928
14930
  };
14929
14931
  class MultistreamConnection extends EventEmitter$2 {
@@ -14937,6 +14939,7 @@ class MultistreamConnection extends EventEmitter$2 {
14937
14939
  this.midPredictor = new MidPredictor();
14938
14940
  this.offerAnswerQueue = new AsyncQueue();
14939
14941
  this.currentCreateOfferId = 0;
14942
+ this.iceCandidates = [];
14940
14943
  this.options = Object.assign(Object.assign({}, defaultMultistreamConnectionOptions), userOptions);
14941
14944
  logger.info(`Creating multistream connection with options ${JSON.stringify(this.options)}`);
14942
14945
  this.metricsCallback = this.options.metricsCallback;
@@ -14988,6 +14991,9 @@ class MultistreamConnection extends EventEmitter$2 {
14988
14991
  this.emit(exports.MultistreamConnectionEventNames.IceGatheringStateUpdate, this.getIceGatheringState());
14989
14992
  });
14990
14993
  this.pc.on(PeerConnection.Events.IceCandidate, (candidate) => {
14994
+ if (candidate.candidate) {
14995
+ this.iceCandidates.push(candidate.candidate);
14996
+ }
14991
14997
  this.emit(exports.MultistreamConnectionEventNames.IceCandidate, candidate);
14992
14998
  });
14993
14999
  this.pc.on(PeerConnection.Events.IceCandidateError, (error) => {
@@ -15138,6 +15144,10 @@ SCTP Max Message Size: ${maxMessageSize}`);
15138
15144
  logger.warn(`Got MediaRequestStatus for unknown receive slot: ${JSON.stringify(s.id)}`);
15139
15145
  return;
15140
15146
  }
15147
+ if (!receiveSlot._isRequested) {
15148
+ logger.info(`MediaRequestStatus ignored due to transceiver's receive slot unrequested: ${JSON.stringify(s.id)} csi ${s.csi}`);
15149
+ return;
15150
+ }
15141
15151
  receiveSlot._updateSource(s.state, s.csi);
15142
15152
  });
15143
15153
  });
@@ -15420,6 +15430,13 @@ SCTP Max Message Size: ${maxMessageSize}`);
15420
15430
  resolve();
15421
15431
  }
15422
15432
  else {
15433
+ this.pc.on(PeerConnection.Events.IceCandidate, (candidate) => {
15434
+ if (candidate.candidate === null ||
15435
+ (this.options.stopIceGatheringAfterFirstRelayCandidate &&
15436
+ candidate.candidate.type === 'relay')) {
15437
+ resolve();
15438
+ }
15439
+ });
15423
15440
  this.pc.on(PeerConnection.Events.IceGatheringStateChange, () => {
15424
15441
  if (this.pc.iceGatheringState === 'complete') {
15425
15442
  resolve();
@@ -15582,9 +15599,14 @@ SCTP Max Message Size: ${maxMessageSize}`);
15582
15599
  });
15583
15600
  }
15584
15601
  if (BrowserInfo.isFirefox() && this.options.doFullIce) {
15585
- const { candidates } = parsedOffer.media[0].iceInfo;
15586
15602
  parsedOffer.media.forEach((media) => {
15587
- media.iceInfo.candidates = candidates;
15603
+ media.iceInfo.candidates = [];
15604
+ this.iceCandidates.forEach((iceCandidate) => {
15605
+ const candidateLine = CandidateLine.fromSdpLine(iceCandidate.candidate.toString());
15606
+ if (candidateLine) {
15607
+ media.addLine(candidateLine);
15608
+ }
15609
+ });
15588
15610
  });
15589
15611
  }
15590
15612
  if (BrowserInfo.isFirefox()) {