@webex/web-client-media-engine 3.30.4 → 3.31.1

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
@@ -7203,6 +7203,7 @@ var WcmeErrorType;
7203
7203
  WcmeErrorType["GET_PAYLOAD_TYPE_FAILED"] = "GET_PAYLOAD_TYPE_FAILED";
7204
7204
  WcmeErrorType["SET_NMG_FAILED"] = "SET_NMG_FAILED";
7205
7205
  WcmeErrorType["DATA_CHANNEL_SEND_FAILED"] = "DATA_CHANNEL_SEND_FAILED";
7206
+ WcmeErrorType["RENEW_PEER_CONNECTION_FAILED"] = "RENEW_PEER_CONNECTION_FAILED";
7206
7207
  })(WcmeErrorType || (WcmeErrorType = {}));
7207
7208
  class WcmeError {
7208
7209
  constructor(type, message = '') {
@@ -9932,7 +9933,7 @@ class EgressSdpMunger {
9932
9933
  }
9933
9934
  }
9934
9935
  }
9935
- mungeRemoteDescription(mediaDescription) {
9936
+ mungeRemoteDescription(mediaDescription, mungeOptions = { dtxDisabled: true }) {
9936
9937
  if (retainCandidatesByTransportType(mediaDescription, ['udp', 'tcp'])) {
9937
9938
  logger.log(`Some unsupported remote candidates have been removed from mid ${mediaDescription.mid}`);
9938
9939
  }
@@ -9940,6 +9941,11 @@ class EgressSdpMunger {
9940
9941
  [...mediaDescription.codecs.values()].forEach((ci) => {
9941
9942
  ci.fmtParams.set('x-google-start-bitrate', '60000');
9942
9943
  });
9944
+ if (mediaDescription.type === 'audio') {
9945
+ [...mediaDescription.codecs.values()].forEach((ci) => {
9946
+ ci.fmtParams.set('usedtx', mungeOptions.dtxDisabled ? '0' : '1');
9947
+ });
9948
+ }
9943
9949
  }
9944
9950
  getSenderIds() {
9945
9951
  return this.streamIds;
@@ -14502,6 +14508,7 @@ class SendOnlyTransceiver extends Transceiver {
14502
14508
  constructor(config) {
14503
14509
  super(config);
14504
14510
  this.rtxEnabled = false;
14511
+ this.dtxDisabled = true;
14505
14512
  this.streamMuteStateChange = new TypedEvent();
14506
14513
  this.streamPublishStateChange = new TypedEvent();
14507
14514
  this.negotiationNeeded = new TypedEvent();
@@ -14722,7 +14729,9 @@ class SendOnlyTransceiver extends Transceiver {
14722
14729
  this.munger.mungeLocalDescriptionForRemoteServer(mediaDescription, getMediaContent(this.mediaType), this.csi, mungeOptions);
14723
14730
  }
14724
14731
  mungeRemoteDescription(mediaDescription) {
14725
- this.munger.mungeRemoteDescription(mediaDescription);
14732
+ this.munger.mungeRemoteDescription(mediaDescription, {
14733
+ dtxDisabled: this.dtxDisabled,
14734
+ });
14726
14735
  }
14727
14736
  get senderIds() {
14728
14737
  return this.munger.getSenderIds();
@@ -14922,6 +14931,7 @@ const defaultMultistreamConnectionOptions = {
14922
14931
  disableAudioTwcc: true,
14923
14932
  doFullIce: BrowserInfo.isFirefox(),
14924
14933
  stopIceGatheringAfterFirstRelayCandidate: false,
14934
+ disableAudioMainDtx: true,
14925
14935
  metricsCallback: () => { },
14926
14936
  };
14927
14937
  class MultistreamConnection extends EventEmitter$2 {
@@ -14954,8 +14964,6 @@ class MultistreamConnection extends EventEmitter$2 {
14954
14964
  this.createSendTransceiver(MediaType.AudioSlides, slidesSceneId);
14955
14965
  }
14956
14966
  initializePeerConnection() {
14957
- var _a;
14958
- (_a = this.pc) === null || _a === void 0 ? void 0 : _a.close();
14959
14967
  this.pc = new PeerConnection({
14960
14968
  iceServers: this.options.iceServers,
14961
14969
  bundlePolicy: this.options.bundlePolicy,
@@ -15055,6 +15063,7 @@ class MultistreamConnection extends EventEmitter$2 {
15055
15063
  }
15056
15064
  transceiver.twccDisabled =
15057
15065
  getMediaFamily(mediaType) === MediaFamily.Audio ? this.options.disableAudioTwcc : false;
15066
+ transceiver.dtxDisabled = mediaType !== MediaType.AudioMain || this.options.disableAudioMainDtx;
15058
15067
  transceiver.active = false;
15059
15068
  transceiver.streamMuteStateChange.on(() => {
15060
15069
  this.sendSourceAdvertisement(mediaType);
@@ -15718,38 +15727,47 @@ SCTP Max Message Size: ${maxMessageSize}`);
15718
15727
  }
15719
15728
  }
15720
15729
  renewPeerConnection(userOptions) {
15721
- if (userOptions) {
15722
- this.options = Object.assign(Object.assign({}, this.options), userOptions);
15723
- }
15724
- logger.info(`Renewing multistream connection with options ${JSON.stringify(this.options)}`);
15725
- this.midPredictor.reset();
15726
- this.initializePeerConnection();
15727
- const mainSceneId = generateSceneId();
15728
- const slidesSceneId = generateSceneId();
15729
- this.sendTransceivers.forEach((transceiver, mediaType) => {
15730
- var _a;
15731
- const mediaContent = getMediaContent(mediaType);
15732
- const sceneId = mediaContent === MediaContent.Main ? mainSceneId : slidesSceneId;
15733
- const mid = this.midPredictor.getNextMid(mediaType);
15734
- transceiver.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
15735
- direction: 'sendrecv',
15736
- sendEncodings: getMediaFamily(mediaType) === MediaFamily.Video
15737
- ? this.getVideoEncodingOptions(mediaContent)
15738
- : undefined,
15739
- }));
15740
- transceiver.mid = mid;
15741
- transceiver.csi = generateCsi(getMediaFamily(mediaType), sceneId);
15742
- transceiver.resetSdpMunger();
15743
- (_a = this.jmpSessions.get(mediaType)) === null || _a === void 0 ? void 0 : _a.close();
15744
- this.createJmpSession(mediaType);
15745
- });
15746
- this.recvTransceivers.forEach((transceivers, mediaType) => {
15747
- transceivers.forEach((t) => {
15730
+ var _a;
15731
+ return __awaiter$1(this, void 0, void 0, function* () {
15732
+ (_a = this.pc) === null || _a === void 0 ? void 0 : _a.close();
15733
+ try {
15734
+ if (userOptions) {
15735
+ this.options = Object.assign(Object.assign({}, this.options), (yield userOptions));
15736
+ }
15737
+ }
15738
+ catch (error) {
15739
+ logErrorAndThrow(WcmeErrorType.RENEW_PEER_CONNECTION_FAILED, `Error while awaiting user options: ${error}`);
15740
+ }
15741
+ logger.info(`Renewing multistream connection with options ${JSON.stringify(this.options)}`);
15742
+ this.midPredictor.reset();
15743
+ this.initializePeerConnection();
15744
+ const mainSceneId = generateSceneId();
15745
+ const slidesSceneId = generateSceneId();
15746
+ this.sendTransceivers.forEach((transceiver, mediaType) => {
15747
+ var _a;
15748
+ const mediaContent = getMediaContent(mediaType);
15749
+ const sceneId = mediaContent === MediaContent.Main ? mainSceneId : slidesSceneId;
15748
15750
  const mid = this.midPredictor.getNextMid(mediaType);
15749
- t.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
15750
- direction: 'recvonly',
15751
+ transceiver.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
15752
+ direction: 'sendrecv',
15753
+ sendEncodings: getMediaFamily(mediaType) === MediaFamily.Video
15754
+ ? this.getVideoEncodingOptions(mediaContent)
15755
+ : undefined,
15751
15756
  }));
15752
- t.mid = mid;
15757
+ transceiver.mid = mid;
15758
+ transceiver.csi = generateCsi(getMediaFamily(mediaType), sceneId);
15759
+ transceiver.resetSdpMunger();
15760
+ (_a = this.jmpSessions.get(mediaType)) === null || _a === void 0 ? void 0 : _a.close();
15761
+ this.createJmpSession(mediaType);
15762
+ });
15763
+ this.recvTransceivers.forEach((transceivers, mediaType) => {
15764
+ transceivers.forEach((t) => {
15765
+ const mid = this.midPredictor.getNextMid(mediaType);
15766
+ t.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
15767
+ direction: 'recvonly',
15768
+ }));
15769
+ t.mid = mid;
15770
+ });
15753
15771
  });
15754
15772
  });
15755
15773
  }