@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/esm/index.js CHANGED
@@ -10588,6 +10588,7 @@ var ReceiveSlotEvents;
10588
10588
  class ReceiveSlot extends EventEmitter$2 {
10589
10589
  constructor(idGetter, track) {
10590
10590
  super();
10591
+ this._isRequested = false;
10591
10592
  this._idGetter = idGetter;
10592
10593
  this.handleStreamMediaStateChange = this.handleStreamMediaStateChange.bind(this);
10593
10594
  this.handleStreamEnded = this.handleStreamEnded.bind(this);
@@ -10690,7 +10691,7 @@ class Transceiver {
10690
10691
  class ReceiveOnlyTransceiver extends Transceiver {
10691
10692
  constructor(config) {
10692
10693
  super(config);
10693
- this.metadata = { isRequested: false, isActiveSpeaker: false };
10694
+ this.metadata = { isActiveSpeaker: false };
10694
10695
  this.munger = config.munger;
10695
10696
  this._receiveSlot = new ReceiveSlot(() => {
10696
10697
  if (!this._rtcRtpTransceiver.mid) {
@@ -10723,7 +10724,7 @@ class ReceiveOnlyTransceiver extends Transceiver {
10723
10724
  stats.requestedBitrate = this.metadata.requestedBitrate;
10724
10725
  stats.requestedFrameSize = this.metadata.requestedFrameSize;
10725
10726
  stats.requestedFrameRate = this.metadata.requestedFrameRate;
10726
- stats.isRequested = this.metadata.isRequested;
10727
+ stats.isRequested = this.receiveSlot._isRequested;
10727
10728
  stats.lastRequestedUpdateTimestamp = this.metadata.lastRequestedUpdateTimestamp;
10728
10729
  stats.isActiveSpeaker = this.metadata.isActiveSpeaker;
10729
10730
  stats.lastActiveSpeakerUpdateTimestamp = this.metadata.lastActiveSpeakerUpdateTimestamp;
@@ -10750,8 +10751,8 @@ class ReceiveOnlyTransceiver extends Transceiver {
10750
10751
  }
10751
10752
  handleRequested(streamRequest) {
10752
10753
  var _a, _b, _c, _d;
10753
- if (!this.metadata.isRequested) {
10754
- this.metadata.isRequested = true;
10754
+ if (!this.receiveSlot._isRequested) {
10755
+ this.receiveSlot._isRequested = true;
10755
10756
  this.metadata.lastRequestedUpdateTimestamp = getCurrentTimestamp();
10756
10757
  }
10757
10758
  this.metadata.requestedBitrate = streamRequest.maxPayloadBitsPerSecond;
@@ -10759,8 +10760,8 @@ class ReceiveOnlyTransceiver extends Transceiver {
10759
10760
  this.metadata.requestedFrameRate = (_d = (_c = streamRequest.codecInfos[0]) === null || _c === void 0 ? void 0 : _c.h264) === null || _d === void 0 ? void 0 : _d.maxFps;
10760
10761
  }
10761
10762
  handleUnrequested() {
10762
- if (this.metadata.isRequested) {
10763
- this.metadata.isRequested = false;
10763
+ if (this.receiveSlot._isRequested) {
10764
+ this.receiveSlot._isRequested = false;
10764
10765
  this.metadata.lastRequestedUpdateTimestamp = getCurrentTimestamp();
10765
10766
  }
10766
10767
  this.metadata.requestedBitrate = undefined;
@@ -14920,6 +14921,7 @@ const defaultMultistreamConnectionOptions = {
14920
14921
  disableContentSimulcast: true,
14921
14922
  disableAudioTwcc: true,
14922
14923
  doFullIce: BrowserInfo.isFirefox(),
14924
+ stopIceGatheringAfterFirstRelayCandidate: false,
14923
14925
  metricsCallback: () => { },
14924
14926
  };
14925
14927
  class MultistreamConnection extends EventEmitter$2 {
@@ -14933,6 +14935,7 @@ class MultistreamConnection extends EventEmitter$2 {
14933
14935
  this.midPredictor = new MidPredictor();
14934
14936
  this.offerAnswerQueue = new AsyncQueue();
14935
14937
  this.currentCreateOfferId = 0;
14938
+ this.iceCandidates = [];
14936
14939
  this.options = Object.assign(Object.assign({}, defaultMultistreamConnectionOptions), userOptions);
14937
14940
  logger.info(`Creating multistream connection with options ${JSON.stringify(this.options)}`);
14938
14941
  this.metricsCallback = this.options.metricsCallback;
@@ -14984,6 +14987,9 @@ class MultistreamConnection extends EventEmitter$2 {
14984
14987
  this.emit(MultistreamConnectionEventNames.IceGatheringStateUpdate, this.getIceGatheringState());
14985
14988
  });
14986
14989
  this.pc.on(PeerConnection.Events.IceCandidate, (candidate) => {
14990
+ if (candidate.candidate) {
14991
+ this.iceCandidates.push(candidate.candidate);
14992
+ }
14987
14993
  this.emit(MultistreamConnectionEventNames.IceCandidate, candidate);
14988
14994
  });
14989
14995
  this.pc.on(PeerConnection.Events.IceCandidateError, (error) => {
@@ -15134,6 +15140,10 @@ SCTP Max Message Size: ${maxMessageSize}`);
15134
15140
  logger.warn(`Got MediaRequestStatus for unknown receive slot: ${JSON.stringify(s.id)}`);
15135
15141
  return;
15136
15142
  }
15143
+ if (!receiveSlot._isRequested) {
15144
+ logger.info(`MediaRequestStatus ignored due to transceiver's receive slot unrequested: ${JSON.stringify(s.id)} csi ${s.csi}`);
15145
+ return;
15146
+ }
15137
15147
  receiveSlot._updateSource(s.state, s.csi);
15138
15148
  });
15139
15149
  });
@@ -15416,6 +15426,13 @@ SCTP Max Message Size: ${maxMessageSize}`);
15416
15426
  resolve();
15417
15427
  }
15418
15428
  else {
15429
+ this.pc.on(PeerConnection.Events.IceCandidate, (candidate) => {
15430
+ if (candidate.candidate === null ||
15431
+ (this.options.stopIceGatheringAfterFirstRelayCandidate &&
15432
+ candidate.candidate.type === 'relay')) {
15433
+ resolve();
15434
+ }
15435
+ });
15419
15436
  this.pc.on(PeerConnection.Events.IceGatheringStateChange, () => {
15420
15437
  if (this.pc.iceGatheringState === 'complete') {
15421
15438
  resolve();
@@ -15578,9 +15595,14 @@ SCTP Max Message Size: ${maxMessageSize}`);
15578
15595
  });
15579
15596
  }
15580
15597
  if (BrowserInfo.isFirefox() && this.options.doFullIce) {
15581
- const { candidates } = parsedOffer.media[0].iceInfo;
15582
15598
  parsedOffer.media.forEach((media) => {
15583
- media.iceInfo.candidates = candidates;
15599
+ media.iceInfo.candidates = [];
15600
+ this.iceCandidates.forEach((iceCandidate) => {
15601
+ const candidateLine = CandidateLine.fromSdpLine(iceCandidate.candidate.toString());
15602
+ if (candidateLine) {
15603
+ media.addLine(candidateLine);
15604
+ }
15605
+ });
15584
15606
  });
15585
15607
  }
15586
15608
  if (BrowserInfo.isFirefox()) {