@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/cjs/index.js CHANGED
@@ -7207,6 +7207,7 @@ exports.WcmeErrorType = void 0;
7207
7207
  WcmeErrorType["GET_PAYLOAD_TYPE_FAILED"] = "GET_PAYLOAD_TYPE_FAILED";
7208
7208
  WcmeErrorType["SET_NMG_FAILED"] = "SET_NMG_FAILED";
7209
7209
  WcmeErrorType["DATA_CHANNEL_SEND_FAILED"] = "DATA_CHANNEL_SEND_FAILED";
7210
+ WcmeErrorType["RENEW_PEER_CONNECTION_FAILED"] = "RENEW_PEER_CONNECTION_FAILED";
7210
7211
  })(exports.WcmeErrorType || (exports.WcmeErrorType = {}));
7211
7212
  class WcmeError {
7212
7213
  constructor(type, message = '') {
@@ -9936,7 +9937,7 @@ class EgressSdpMunger {
9936
9937
  }
9937
9938
  }
9938
9939
  }
9939
- mungeRemoteDescription(mediaDescription) {
9940
+ mungeRemoteDescription(mediaDescription, mungeOptions = { dtxDisabled: true }) {
9940
9941
  if (retainCandidatesByTransportType(mediaDescription, ['udp', 'tcp'])) {
9941
9942
  logger.log(`Some unsupported remote candidates have been removed from mid ${mediaDescription.mid}`);
9942
9943
  }
@@ -9944,6 +9945,11 @@ class EgressSdpMunger {
9944
9945
  [...mediaDescription.codecs.values()].forEach((ci) => {
9945
9946
  ci.fmtParams.set('x-google-start-bitrate', '60000');
9946
9947
  });
9948
+ if (mediaDescription.type === 'audio') {
9949
+ [...mediaDescription.codecs.values()].forEach((ci) => {
9950
+ ci.fmtParams.set('usedtx', mungeOptions.dtxDisabled ? '0' : '1');
9951
+ });
9952
+ }
9947
9953
  }
9948
9954
  getSenderIds() {
9949
9955
  return this.streamIds;
@@ -14506,6 +14512,7 @@ class SendOnlyTransceiver extends Transceiver {
14506
14512
  constructor(config) {
14507
14513
  super(config);
14508
14514
  this.rtxEnabled = false;
14515
+ this.dtxDisabled = true;
14509
14516
  this.streamMuteStateChange = new TypedEvent();
14510
14517
  this.streamPublishStateChange = new TypedEvent();
14511
14518
  this.negotiationNeeded = new TypedEvent();
@@ -14726,7 +14733,9 @@ class SendOnlyTransceiver extends Transceiver {
14726
14733
  this.munger.mungeLocalDescriptionForRemoteServer(mediaDescription, getMediaContent(this.mediaType), this.csi, mungeOptions);
14727
14734
  }
14728
14735
  mungeRemoteDescription(mediaDescription) {
14729
- this.munger.mungeRemoteDescription(mediaDescription);
14736
+ this.munger.mungeRemoteDescription(mediaDescription, {
14737
+ dtxDisabled: this.dtxDisabled,
14738
+ });
14730
14739
  }
14731
14740
  get senderIds() {
14732
14741
  return this.munger.getSenderIds();
@@ -14926,6 +14935,7 @@ const defaultMultistreamConnectionOptions = {
14926
14935
  disableAudioTwcc: true,
14927
14936
  doFullIce: BrowserInfo.isFirefox(),
14928
14937
  stopIceGatheringAfterFirstRelayCandidate: false,
14938
+ disableAudioMainDtx: true,
14929
14939
  metricsCallback: () => { },
14930
14940
  };
14931
14941
  class MultistreamConnection extends EventEmitter$2 {
@@ -14958,8 +14968,6 @@ class MultistreamConnection extends EventEmitter$2 {
14958
14968
  this.createSendTransceiver(exports.MediaType.AudioSlides, slidesSceneId);
14959
14969
  }
14960
14970
  initializePeerConnection() {
14961
- var _a;
14962
- (_a = this.pc) === null || _a === void 0 ? void 0 : _a.close();
14963
14971
  this.pc = new PeerConnection({
14964
14972
  iceServers: this.options.iceServers,
14965
14973
  bundlePolicy: this.options.bundlePolicy,
@@ -15059,6 +15067,7 @@ class MultistreamConnection extends EventEmitter$2 {
15059
15067
  }
15060
15068
  transceiver.twccDisabled =
15061
15069
  getMediaFamily(mediaType) === exports.MediaFamily.Audio ? this.options.disableAudioTwcc : false;
15070
+ transceiver.dtxDisabled = mediaType !== exports.MediaType.AudioMain || this.options.disableAudioMainDtx;
15062
15071
  transceiver.active = false;
15063
15072
  transceiver.streamMuteStateChange.on(() => {
15064
15073
  this.sendSourceAdvertisement(mediaType);
@@ -15722,38 +15731,47 @@ SCTP Max Message Size: ${maxMessageSize}`);
15722
15731
  }
15723
15732
  }
15724
15733
  renewPeerConnection(userOptions) {
15725
- if (userOptions) {
15726
- this.options = Object.assign(Object.assign({}, this.options), userOptions);
15727
- }
15728
- logger.info(`Renewing multistream connection with options ${JSON.stringify(this.options)}`);
15729
- this.midPredictor.reset();
15730
- this.initializePeerConnection();
15731
- const mainSceneId = generateSceneId();
15732
- const slidesSceneId = generateSceneId();
15733
- this.sendTransceivers.forEach((transceiver, mediaType) => {
15734
- var _a;
15735
- const mediaContent = getMediaContent(mediaType);
15736
- const sceneId = mediaContent === exports.MediaContent.Main ? mainSceneId : slidesSceneId;
15737
- const mid = this.midPredictor.getNextMid(mediaType);
15738
- transceiver.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
15739
- direction: 'sendrecv',
15740
- sendEncodings: getMediaFamily(mediaType) === exports.MediaFamily.Video
15741
- ? this.getVideoEncodingOptions(mediaContent)
15742
- : undefined,
15743
- }));
15744
- transceiver.mid = mid;
15745
- transceiver.csi = generateCsi(getMediaFamily(mediaType), sceneId);
15746
- transceiver.resetSdpMunger();
15747
- (_a = this.jmpSessions.get(mediaType)) === null || _a === void 0 ? void 0 : _a.close();
15748
- this.createJmpSession(mediaType);
15749
- });
15750
- this.recvTransceivers.forEach((transceivers, mediaType) => {
15751
- transceivers.forEach((t) => {
15734
+ var _a;
15735
+ return __awaiter$1(this, void 0, void 0, function* () {
15736
+ (_a = this.pc) === null || _a === void 0 ? void 0 : _a.close();
15737
+ try {
15738
+ if (userOptions) {
15739
+ this.options = Object.assign(Object.assign({}, this.options), (yield userOptions));
15740
+ }
15741
+ }
15742
+ catch (error) {
15743
+ logErrorAndThrow(exports.WcmeErrorType.RENEW_PEER_CONNECTION_FAILED, `Error while awaiting user options: ${error}`);
15744
+ }
15745
+ logger.info(`Renewing multistream connection with options ${JSON.stringify(this.options)}`);
15746
+ this.midPredictor.reset();
15747
+ this.initializePeerConnection();
15748
+ const mainSceneId = generateSceneId();
15749
+ const slidesSceneId = generateSceneId();
15750
+ this.sendTransceivers.forEach((transceiver, mediaType) => {
15751
+ var _a;
15752
+ const mediaContent = getMediaContent(mediaType);
15753
+ const sceneId = mediaContent === exports.MediaContent.Main ? mainSceneId : slidesSceneId;
15752
15754
  const mid = this.midPredictor.getNextMid(mediaType);
15753
- t.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
15754
- direction: 'recvonly',
15755
+ transceiver.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
15756
+ direction: 'sendrecv',
15757
+ sendEncodings: getMediaFamily(mediaType) === exports.MediaFamily.Video
15758
+ ? this.getVideoEncodingOptions(mediaContent)
15759
+ : undefined,
15755
15760
  }));
15756
- t.mid = mid;
15761
+ transceiver.mid = mid;
15762
+ transceiver.csi = generateCsi(getMediaFamily(mediaType), sceneId);
15763
+ transceiver.resetSdpMunger();
15764
+ (_a = this.jmpSessions.get(mediaType)) === null || _a === void 0 ? void 0 : _a.close();
15765
+ this.createJmpSession(mediaType);
15766
+ });
15767
+ this.recvTransceivers.forEach((transceivers, mediaType) => {
15768
+ transceivers.forEach((t) => {
15769
+ const mid = this.midPredictor.getNextMid(mediaType);
15770
+ t.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
15771
+ direction: 'recvonly',
15772
+ }));
15773
+ t.mid = mid;
15774
+ });
15757
15775
  });
15758
15776
  });
15759
15777
  }