@webex/web-client-media-engine 3.23.3 → 3.23.4

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
@@ -6446,6 +6446,10 @@ Logger$1.useDefaults({
6446
6446
  },
6447
6447
  });
6448
6448
 
6449
+ function areNamedMediaGroupsEqual(left, right) {
6450
+ return left.type === right.type && left.value === right.value;
6451
+ }
6452
+
6449
6453
  exports.MediaFamily = void 0;
6450
6454
  (function (MediaFamily) {
6451
6455
  MediaFamily["Audio"] = "AUDIO";
@@ -6507,8 +6511,8 @@ function getMediaContent(mediaType) {
6507
6511
  ? exports.MediaContent.Main
6508
6512
  : exports.MediaContent.Slides;
6509
6513
  }
6510
- const truthyOrZero = (value) => value === 0 || value;
6511
- function arraysAreEqual(left, right, predicate) {
6514
+ const isTruthyOrZero = (value) => value === 0 || Boolean(value);
6515
+ function areArraysEqual(left, right, predicate) {
6512
6516
  if (left.length !== right.length) {
6513
6517
  return false;
6514
6518
  }
@@ -6539,24 +6543,48 @@ function isValidActiveSpeakerInfo(msg) {
6539
6543
  'crossPolicyDuplication' in maybeActiveSpeakerInfo &&
6540
6544
  'preferLiveVideo' in maybeActiveSpeakerInfo);
6541
6545
  }
6542
- function areNamedMediaGroupArraysEqual(left, right) {
6543
- if (left === undefined || right === undefined) {
6544
- return left === right;
6545
- }
6546
- return arraysAreEqual(left, right, (l, r) => l.type === r.type && l.value === r.value);
6547
- }
6548
6546
  function areActiveSpeakerInfosEqual(left, right) {
6549
6547
  return (left.priority === right.priority &&
6550
6548
  left.crossPriorityDuplication === right.crossPriorityDuplication &&
6551
6549
  left.crossPolicyDuplication === right.crossPolicyDuplication &&
6552
6550
  left.preferLiveVideo === right.preferLiveVideo &&
6553
- areNamedMediaGroupArraysEqual(left.namedMediaGroups, right.namedMediaGroups));
6551
+ areArraysEqual(left.namedMediaGroups || [], right.namedMediaGroups || [], areNamedMediaGroupsEqual));
6554
6552
  }
6555
6553
  function isValidActiveSpeakerNotificationMsg(msg) {
6556
6554
  const maybeActiveSpeakerNotificationMsg = msg;
6557
6555
  return Boolean(maybeActiveSpeakerNotificationMsg.seqNum && maybeActiveSpeakerNotificationMsg.csis);
6558
6556
  }
6559
6557
 
6558
+ class H264Codec {
6559
+ constructor(maxFs, maxFps, maxMbps, maxWidth, maxHeight) {
6560
+ this.maxFs = maxFs;
6561
+ this.maxFps = maxFps;
6562
+ this.maxMbps = maxMbps;
6563
+ this.maxWidth = maxWidth;
6564
+ this.maxHeight = maxHeight;
6565
+ }
6566
+ }
6567
+ function areH264CodecsEqual(left, right) {
6568
+ if (left === undefined || right === undefined) {
6569
+ return left === right;
6570
+ }
6571
+ return (left.maxFs === right.maxFs &&
6572
+ left.maxFps === right.maxFps &&
6573
+ left.maxMbps === right.maxMbps &&
6574
+ left.maxWidth === right.maxWidth &&
6575
+ left.maxHeight === right.maxHeight);
6576
+ }
6577
+
6578
+ class CodecInfo$1 {
6579
+ constructor(payloadType, h264) {
6580
+ this.payloadType = payloadType;
6581
+ this.h264 = h264;
6582
+ }
6583
+ }
6584
+ function areCodecInfosEqual(left, right) {
6585
+ return left.payloadType === right.payloadType && areH264CodecsEqual(left.h264, right.h264);
6586
+ }
6587
+
6560
6588
  var HomerMsgType;
6561
6589
  (function (HomerMsgType) {
6562
6590
  HomerMsgType["Multistream"] = "multistream";
@@ -6633,14 +6661,26 @@ function isValidMediaRequestAckMsg(msg) {
6633
6661
  return Boolean(maybeMediaRequestAckMsg.mediaRequestSeqNum);
6634
6662
  }
6635
6663
 
6636
- function isValidStreamId(obj) {
6637
- const maybeStreamId = obj;
6638
- if (maybeStreamId.mid && maybeStreamId.ssrc) {
6664
+ function isValidMidRidStreamId(obj) {
6665
+ if (typeof obj !== 'object' || obj === null)
6639
6666
  return false;
6640
- }
6641
- return Boolean(maybeStreamId.mid) || Boolean(maybeStreamId.ssrc);
6667
+ const maybeMidRidStreamId = obj;
6668
+ return (typeof maybeMidRidStreamId.mid === 'string' &&
6669
+ (maybeMidRidStreamId.rid === undefined || typeof maybeMidRidStreamId.rid === 'string') &&
6670
+ !('ssrc' in maybeMidRidStreamId));
6642
6671
  }
6643
- function compareStreamIds(id1, id2) {
6672
+ function isValidSsrcStreamId(obj) {
6673
+ if (typeof obj !== 'object' || obj === null)
6674
+ return false;
6675
+ const maybeSsrcStreamId = obj;
6676
+ return (typeof maybeSsrcStreamId.ssrc === 'number' &&
6677
+ (maybeSsrcStreamId.rtxSsrc === undefined || typeof maybeSsrcStreamId.rtxSsrc === 'number') &&
6678
+ !('mid' in maybeSsrcStreamId));
6679
+ }
6680
+ function isValidStreamId(obj) {
6681
+ return isValidMidRidStreamId(obj) || isValidSsrcStreamId(obj);
6682
+ }
6683
+ function areStreamIdsEqual(id1, id2) {
6644
6684
  const keys1 = Object.keys(id1);
6645
6685
  const keys2 = Object.keys(id2);
6646
6686
  if (keys1.length !== keys2.length) {
@@ -6655,6 +6695,10 @@ function isValidStreamInfo(obj) {
6655
6695
  isValidStreamId(maybeStreamInfo.id) &&
6656
6696
  ['no source', 'invalid source', 'live', 'avatar', 'bandwidth disabled'].includes(maybeStreamInfo.state));
6657
6697
  }
6698
+ function areStreamInfosEqual(left, right) {
6699
+ return (areStreamIdsEqual(left.id, right.id) && left.state === right.state && left.csi === right.csi);
6700
+ }
6701
+
6658
6702
  class MediaRequestStatusMsg {
6659
6703
  constructor(seqNum, streamStates) {
6660
6704
  this.seqNum = seqNum;
@@ -6666,24 +6710,6 @@ function isValidMediaRequestStatusMsg(msg) {
6666
6710
  return (Boolean(maybeMediaRequestStatusMsg.seqNum) &&
6667
6711
  maybeMediaRequestStatusMsg.streamStates &&
6668
6712
  maybeMediaRequestStatusMsg.streamStates.every((streamInfo) => isValidStreamInfo(streamInfo)));
6669
- }
6670
- function compareStreamStateArrays(streamStates1, streamStates2) {
6671
- var _a, _b;
6672
- if (streamStates1.length !== streamStates2.length) {
6673
- return false;
6674
- }
6675
- for (let i = 0; i < streamStates1.length; i += 1) {
6676
- if (!compareStreamIds(streamStates1[i].id, streamStates2[i].id)) {
6677
- return false;
6678
- }
6679
- if (streamStates1[i].state !== streamStates2[i].state) {
6680
- return false;
6681
- }
6682
- if (((_a = streamStates1[i]) === null || _a === void 0 ? void 0 : _a.csi) !== ((_b = streamStates2[i]) === null || _b === void 0 ? void 0 : _b.csi)) {
6683
- return false;
6684
- }
6685
- }
6686
- return true;
6687
6713
  }
6688
6714
 
6689
6715
  class MediaRequestStatusAckMsg {
@@ -6699,36 +6725,6 @@ function isValidMediaRequestStatusAckMsg(msg) {
6699
6725
  return Boolean(maybeMediaRequestStatusAckMsg.mediaRequestStatusSeqNum);
6700
6726
  }
6701
6727
 
6702
- class H264Codec {
6703
- constructor(maxFs, maxFps, maxMbps, maxWidth, maxHeight) {
6704
- this.maxFs = maxFs;
6705
- this.maxFps = maxFps;
6706
- this.maxMbps = maxMbps;
6707
- this.maxWidth = maxWidth;
6708
- this.maxHeight = maxHeight;
6709
- }
6710
- }
6711
- function areH264CodecsEqual(left, right) {
6712
- if (left === undefined || right === undefined) {
6713
- return left === right;
6714
- }
6715
- return (left.maxFs === right.maxFs &&
6716
- left.maxFps === right.maxFps &&
6717
- left.maxMbps === right.maxMbps &&
6718
- left.maxWidth === right.maxWidth &&
6719
- left.maxHeight === right.maxHeight);
6720
- }
6721
-
6722
- class CodecInfo$1 {
6723
- constructor(payloadType, h264) {
6724
- this.payloadType = payloadType;
6725
- this.h264 = h264;
6726
- }
6727
- }
6728
- function areCodecInfosEqual(left, right) {
6729
- return left.payloadType === right.payloadType && areH264CodecsEqual(left.h264, right.h264);
6730
- }
6731
-
6732
6728
  class ReceiverSelectedInfo {
6733
6729
  constructor(csi) {
6734
6730
  this.csi = csi;
@@ -6745,6 +6741,22 @@ function areReceiverSelectedInfosEqual(left, right) {
6745
6741
  return left.csi === right.csi;
6746
6742
  }
6747
6743
 
6744
+ function arePolicySpecificInfosEqual(left, right) {
6745
+ if (isValidActiveSpeakerInfo(left)) {
6746
+ if (!isValidActiveSpeakerInfo(right)) {
6747
+ return false;
6748
+ }
6749
+ return areActiveSpeakerInfosEqual(left, right);
6750
+ }
6751
+ if (isValidReceiverSelectedInfo(left)) {
6752
+ if (!isValidReceiverSelectedInfo(right)) {
6753
+ return false;
6754
+ }
6755
+ return areReceiverSelectedInfosEqual(left, right);
6756
+ }
6757
+ throw new Error('Invalid PolicySpecificInfo');
6758
+ }
6759
+
6748
6760
  class SourceAdvertisementMsg {
6749
6761
  constructor(seqNum, numTotalSources, numLiveSources, namedMediaGroups, videoContentHint) {
6750
6762
  this.seqNum = seqNum;
@@ -6760,28 +6772,13 @@ class SourceAdvertisementMsg {
6760
6772
  function isValidSourceAdvertisementMsg(msg) {
6761
6773
  const maybeSourceAdvertisementMsg = msg;
6762
6774
  return Boolean(maybeSourceAdvertisementMsg.seqNum &&
6763
- truthyOrZero(maybeSourceAdvertisementMsg.numTotalSources) &&
6764
- truthyOrZero(maybeSourceAdvertisementMsg.numLiveSources));
6765
- }
6766
- function compareNamedMediaGroupArrays(namedMediaGroups1, namedMediaGroups2) {
6767
- var _a, _b;
6768
- if (namedMediaGroups1.length !== namedMediaGroups2.length) {
6769
- return false;
6770
- }
6771
- for (let i = 0; i < namedMediaGroups1.length; i += 1) {
6772
- if (namedMediaGroups1[i].type !== namedMediaGroups2[i].type) {
6773
- return false;
6774
- }
6775
- if (((_a = namedMediaGroups1[i]) === null || _a === void 0 ? void 0 : _a.value) !== ((_b = namedMediaGroups2[i]) === null || _b === void 0 ? void 0 : _b.value)) {
6776
- return false;
6777
- }
6778
- }
6779
- return true;
6775
+ isTruthyOrZero(maybeSourceAdvertisementMsg.numTotalSources) &&
6776
+ isTruthyOrZero(maybeSourceAdvertisementMsg.numLiveSources));
6780
6777
  }
6781
- function compareSourceAdvertisementMsgs(sourceAdvertisementMsg1, sourceAdvertisementMsg2) {
6778
+ function areSourceAdvertisementMsgsEqual(sourceAdvertisementMsg1, sourceAdvertisementMsg2) {
6782
6779
  return (sourceAdvertisementMsg1.numLiveSources === sourceAdvertisementMsg2.numLiveSources &&
6783
6780
  sourceAdvertisementMsg1.numTotalSources === sourceAdvertisementMsg2.numTotalSources &&
6784
- compareNamedMediaGroupArrays(sourceAdvertisementMsg1.namedMediaGroups || [], sourceAdvertisementMsg2.namedMediaGroups || []) &&
6781
+ areArraysEqual(sourceAdvertisementMsg1.namedMediaGroups || [], sourceAdvertisementMsg2.namedMediaGroups || [], areNamedMediaGroupsEqual) &&
6785
6782
  sourceAdvertisementMsg1.videoContentHint === sourceAdvertisementMsg2.videoContentHint);
6786
6783
  }
6787
6784
 
@@ -6810,27 +6807,6 @@ class StreamRequest$1 {
6810
6807
  return `Request(policy=${this.policy}, info=${this.policySpecificInfo}, ids=[${this.ids}], maxPayloadBitsPerSecond=[${this.maxPayloadBitsPerSecond}], codecInfos=[${this.codecInfos}])`;
6811
6808
  }
6812
6809
  }
6813
- function arePolicySpecificInfosEqual(left, right) {
6814
- if (isValidActiveSpeakerInfo(left)) {
6815
- if (!isValidActiveSpeakerInfo(right)) {
6816
- return false;
6817
- }
6818
- return areActiveSpeakerInfosEqual(left, right);
6819
- }
6820
- if (isValidReceiverSelectedInfo(left)) {
6821
- if (!isValidReceiverSelectedInfo(right)) {
6822
- return false;
6823
- }
6824
- return areReceiverSelectedInfosEqual(left, right);
6825
- }
6826
- throw new Error('Invalid PolicySpecificInfo');
6827
- }
6828
- function areCodecInfoArraysEqual(left, right) {
6829
- return arraysAreEqual(left, right, areCodecInfosEqual);
6830
- }
6831
- function areStreamIdArraysEqual(left, right) {
6832
- return arraysAreEqual(left, right, compareStreamIds);
6833
- }
6834
6810
  function areStreamRequestsEqual(left, right) {
6835
6811
  if (left.policy !== right.policy) {
6836
6812
  return false;
@@ -6838,16 +6814,13 @@ function areStreamRequestsEqual(left, right) {
6838
6814
  if (!arePolicySpecificInfosEqual(left.policySpecificInfo, right.policySpecificInfo)) {
6839
6815
  return false;
6840
6816
  }
6841
- if (!areStreamIdArraysEqual(left.ids, right.ids)) {
6817
+ if (!areArraysEqual(left.ids, right.ids, areStreamIdsEqual)) {
6842
6818
  return false;
6843
6819
  }
6844
6820
  if (left.maxPayloadBitsPerSecond !== right.maxPayloadBitsPerSecond) {
6845
6821
  return false;
6846
6822
  }
6847
- if (!areCodecInfoArraysEqual(left.codecInfos, right.codecInfos)) {
6848
- return false;
6849
- }
6850
- return true;
6823
+ return areArraysEqual(left.codecInfos, right.codecInfos, areCodecInfosEqual);
6851
6824
  }
6852
6825
 
6853
6826
  class RetransmitHandler {
@@ -6889,17 +6862,6 @@ var JmpSessionEvents;
6889
6862
  JmpSessionEvents["MediaRequestStatusReceived"] = "media-request-status-received";
6890
6863
  JmpSessionEvents["SourceAdvertisementReceived"] = "source-advertisement-received";
6891
6864
  })(JmpSessionEvents || (JmpSessionEvents = {}));
6892
- function areStreamRequestArraysEqual(left, right) {
6893
- if (left.length !== right.length) {
6894
- return false;
6895
- }
6896
- for (let i = 0; i < left.length; i += 1) {
6897
- if (!areStreamRequestsEqual(left[i], right[i])) {
6898
- return false;
6899
- }
6900
- }
6901
- return true;
6902
- }
6903
6865
  class JmpSession extends events$3.EventEmitter {
6904
6866
  constructor(mediaFamily, mediaContent, maxNumRetransmits = 200, retransmitIntervalMs = 250) {
6905
6867
  super();
@@ -6923,7 +6885,7 @@ class JmpSession extends events$3.EventEmitter {
6923
6885
  var _a;
6924
6886
  const mediaRequestMsg = new MediaRequestMsg(this.currMediaRequestSeqNum, requests);
6925
6887
  if (!this.lastSentMediaRequest ||
6926
- !areStreamRequestArraysEqual(this.lastSentMediaRequest.msg.requests, requests)) {
6888
+ !areArraysEqual(this.lastSentMediaRequest.msg.requests, requests, areStreamRequestsEqual)) {
6927
6889
  this.sendJmpMsg(JmpMsgType.MediaRequest, mediaRequestMsg);
6928
6890
  (_a = this.lastSentMediaRequest) === null || _a === void 0 ? void 0 : _a.cancel();
6929
6891
  this.lastSentMediaRequest = new RetransmitHandler(mediaRequestMsg, this.maxNumRetransmits, this.retransmitIntervalMs, () => {
@@ -6942,7 +6904,7 @@ class JmpSession extends events$3.EventEmitter {
6942
6904
  var _a;
6943
6905
  const sourceAdvertisementMsg = new SourceAdvertisementMsg(this.currSourceAdvertisementSeqNum, numTotalSources, numLiveSources, namedMediaGroups, videoContentHint);
6944
6906
  if (!this.lastSentSourceAdvertisement ||
6945
- !compareSourceAdvertisementMsgs(this.lastSentSourceAdvertisement.msg, sourceAdvertisementMsg)) {
6907
+ !areSourceAdvertisementMsgsEqual(this.lastSentSourceAdvertisement.msg, sourceAdvertisementMsg)) {
6946
6908
  this.sendJmpMsg(JmpMsgType.SourceAdvertisement, sourceAdvertisementMsg);
6947
6909
  (_a = this.lastSentSourceAdvertisement) === null || _a === void 0 ? void 0 : _a.cancel();
6948
6910
  this.lastSentSourceAdvertisement = new RetransmitHandler(sourceAdvertisementMsg, this.maxNumRetransmits, this.retransmitIntervalMs, () => {
@@ -6961,11 +6923,11 @@ class JmpSession extends events$3.EventEmitter {
6961
6923
  var _a, _b;
6962
6924
  const filteredStreamStates = streamStates.filter((streamState) => {
6963
6925
  var _a;
6964
- return (_a = this.lastReceivedMediaRequest) === null || _a === void 0 ? void 0 : _a.requests.some((req) => req.ids.find((streamId) => compareStreamIds(streamId, streamState.id)));
6926
+ return (_a = this.lastReceivedMediaRequest) === null || _a === void 0 ? void 0 : _a.requests.some((req) => req.ids.find((streamId) => areStreamIdsEqual(streamId, streamState.id)));
6965
6927
  });
6966
6928
  const mediaRequestStatus = new MediaRequestStatusMsg(this.currMediaRequestStatusSeqNum, filteredStreamStates);
6967
6929
  if (!((_a = this.lastSentMediaRequestStatus) === null || _a === void 0 ? void 0 : _a.msg.streamStates) ||
6968
- !compareStreamStateArrays(filteredStreamStates, this.lastSentMediaRequestStatus.msg.streamStates)) {
6930
+ !areArraysEqual(filteredStreamStates, this.lastSentMediaRequestStatus.msg.streamStates, areStreamInfosEqual)) {
6969
6931
  this.sendJmpMsg(JmpMsgType.MediaRequestStatus, mediaRequestStatus);
6970
6932
  (_b = this.lastSentMediaRequestStatus) === null || _b === void 0 ? void 0 : _b.cancel();
6971
6933
  this.lastSentMediaRequestStatus = new RetransmitHandler(mediaRequestStatus, this.maxNumRetransmits, this.retransmitIntervalMs, () => {
@@ -9826,7 +9788,7 @@ class EgressSdpMunger {
9826
9788
  const simulcastSsrcs = (_a = mediaDescription.ssrcGroups.find((sg) => sg.semantics === 'SIM')) === null || _a === void 0 ? void 0 : _a.ssrcs;
9827
9789
  if (simulcastSsrcs) {
9828
9790
  if (simulcastSsrcs.length !== numStreams ||
9829
- !this.streamIds.every((streamId) => simulcastSsrcs.includes(streamId.ssrc))) {
9791
+ !this.streamIds.every(({ ssrc }) => simulcastSsrcs.includes(ssrc))) {
9830
9792
  logErrorAndThrow(exports.WcmeErrorType.SDP_MUNGE_FAILED, 'SSRCs in simulcast SSRC group do not match primary SSRCs in RTX SSRC groups.');
9831
9793
  }
9832
9794
  this.streamIds.sort((a, b) => simulcastSsrcs.indexOf(a.ssrc) - simulcastSsrcs.indexOf(b.ssrc));
@@ -9857,10 +9819,12 @@ class EgressSdpMunger {
9857
9819
  mediaDescription.addLine(new SsrcLine(rtpSsrc, 'cname', `${rtpSsrc}-cname`));
9858
9820
  mediaDescription.addLine(new SsrcLine(rtpSsrc, 'msid', '-', `${mediaDescription.mid}`));
9859
9821
  if (options.rtxEnabled) {
9860
- const rtxSsrc = streamId.rtxSsrc;
9861
- mediaDescription.addLine(new SsrcLine(rtxSsrc, 'cname', `${rtpSsrc}-cname`));
9862
- mediaDescription.addLine(new SsrcLine(rtxSsrc, 'msid', '-', `${mediaDescription.mid}`));
9863
- mediaDescription.addLine(new SsrcGroupLine('FID', [rtpSsrc, rtxSsrc]));
9822
+ const { rtxSsrc } = streamId;
9823
+ if (rtxSsrc) {
9824
+ mediaDescription.addLine(new SsrcLine(rtxSsrc, 'cname', `${rtpSsrc}-cname`));
9825
+ mediaDescription.addLine(new SsrcLine(rtxSsrc, 'msid', '-', `${mediaDescription.mid}`));
9826
+ mediaDescription.addLine(new SsrcGroupLine('FID', [rtpSsrc, rtxSsrc]));
9827
+ }
9864
9828
  }
9865
9829
  });
9866
9830
  if (options.simulcastEnabled) {
@@ -9899,7 +9863,7 @@ class EgressSdpMunger {
9899
9863
  return this.streamIds;
9900
9864
  }
9901
9865
  getEncodingIndexForStreamId(streamId) {
9902
- return this.streamIds.findIndex((currStreamId) => compareStreamIds(currStreamId, streamId));
9866
+ return this.streamIds.findIndex((currStreamId) => areStreamIdsEqual(currStreamId, streamId));
9903
9867
  }
9904
9868
  setCodecParameters(parameters) {
9905
9869
  Object.entries(parameters).forEach(([param, value]) => {
@@ -10497,8 +10461,8 @@ class OveruseStateManager {
10497
10461
  }
10498
10462
  }
10499
10463
 
10500
- function compareReceiveSlotIds(id1, id2) {
10501
- return compareStreamIds(id1, id2);
10464
+ function areReceiveSlotIdsEqual(id1, id2) {
10465
+ return areStreamIdsEqual(id1, id2);
10502
10466
  }
10503
10467
  exports.ReceiveSlotEvents = void 0;
10504
10468
  (function (ReceiveSlotEvents) {
@@ -10578,10 +10542,11 @@ class StatsManager {
10578
10542
  }
10579
10543
 
10580
10544
  class Transceiver {
10581
- constructor(rtcRtpTransceiver, mid) {
10545
+ constructor(config) {
10582
10546
  this.twccDisabled = false;
10583
- this._rtcRtpTransceiver = rtcRtpTransceiver;
10584
- this.mid = mid;
10547
+ this._rtcRtpTransceiver = config.rtcRtpTransceiver;
10548
+ this.mid = config.mid;
10549
+ this.mediaType = config.mediaType;
10585
10550
  }
10586
10551
  replaceTransceiver(newRtcRtpTransceiver) {
10587
10552
  this._rtcRtpTransceiver = newRtcRtpTransceiver;
@@ -10598,10 +10563,10 @@ class Transceiver {
10598
10563
  }
10599
10564
 
10600
10565
  class ReceiveOnlyTransceiver extends Transceiver {
10601
- constructor(rtcRtpTransceiver, mid, munger) {
10602
- super(rtcRtpTransceiver, mid);
10566
+ constructor(config) {
10567
+ super(config);
10603
10568
  this.metadata = { isRequested: false, isActiveSpeaker: false };
10604
- this.munger = munger;
10569
+ this.munger = config.munger;
10605
10570
  this._receiveSlot = new ReceiveSlot(() => {
10606
10571
  if (!this._rtcRtpTransceiver.mid) {
10607
10572
  return null;
@@ -10629,7 +10594,7 @@ class ReceiveOnlyTransceiver extends Transceiver {
10629
10594
  stats.mid = this.mid;
10630
10595
  stats.csi = this.receiveSlot.currentRxCsi;
10631
10596
  stats.sourceState = this.receiveSlot.sourceState;
10632
- stats.calliopeMediaType = this.metadata.mediaType;
10597
+ stats.calliopeMediaType = this.mediaType;
10633
10598
  stats.requestedBitrate = this.metadata.requestedBitrate;
10634
10599
  stats.requestedFrameSize = this.metadata.requestedFrameSize;
10635
10600
  stats.isRequested = this.metadata.isRequested;
@@ -14397,8 +14362,8 @@ var OfferAnswerType;
14397
14362
  OfferAnswerType[OfferAnswerType["Remote"] = 1] = "Remote";
14398
14363
  })(OfferAnswerType || (OfferAnswerType = {}));
14399
14364
  class SendOnlyTransceiver extends Transceiver {
14400
- constructor(rtcRtpTransceiver, mid, csi, munger, mediaType) {
14401
- super(rtcRtpTransceiver, mid);
14365
+ constructor(config) {
14366
+ super(config);
14402
14367
  this.rtxEnabled = false;
14403
14368
  this.streamMuteStateChange = new TypedEvent();
14404
14369
  this.streamPublishStateChange = new TypedEvent();
@@ -14407,13 +14372,12 @@ class SendOnlyTransceiver extends Transceiver {
14407
14372
  this.requestedIdEncodingParamsMap = new Map();
14408
14373
  this.updateSendParametersQueue = new AsyncQueue();
14409
14374
  this.metadata = { lastRequestedUpdateTimestampsMap: new Map() };
14410
- this.csi = csi;
14375
+ this.munger = config.munger;
14376
+ this.csi = config.csi;
14411
14377
  this.direction = 'sendrecv';
14412
14378
  this.handleTrackChange = this.handleTrackChange.bind(this);
14413
14379
  this.handleStreamConstraintsChange = this.handleStreamConstraintsChange.bind(this);
14414
14380
  this.handleStreamMuteStateChange = this.handleStreamMuteStateChange.bind(this);
14415
- this.munger = munger;
14416
- this.mediaType = mediaType;
14417
14381
  }
14418
14382
  replaceSenderSource(stream) {
14419
14383
  var _a, _b;
@@ -14734,13 +14698,12 @@ const organizeTransceiverStats = (sendTransceivers, recvTransceivers) => __await
14734
14698
  })));
14735
14699
  yield Promise.all([...recvTransceivers.entries()].map(([mediaType, transceivers]) => __awaiter$1(void 0, void 0, void 0, function* () {
14736
14700
  return Promise.all(transceivers.map((t) => __awaiter$1(void 0, void 0, void 0, function* () {
14737
- var _b, _c;
14701
+ var _b;
14738
14702
  const item = {
14739
14703
  report: yield t.getStats(),
14740
- mid: (_b = t.receiveSlot.id) === null || _b === void 0 ? void 0 : _b.mid,
14741
14704
  csi: t.receiveSlot.currentRxCsi,
14742
14705
  currentDirection: 'recvonly',
14743
- localTrackLabel: (_c = t.receiveSlot.stream.getTracks()[0]) === null || _c === void 0 ? void 0 : _c.label,
14706
+ localTrackLabel: (_b = t.receiveSlot.stream.getTracks()[0]) === null || _b === void 0 ? void 0 : _b.label,
14744
14707
  };
14745
14708
  if (mediaType === exports.MediaType.AudioMain) {
14746
14709
  result.audio.receivers.push(item);
@@ -14892,9 +14855,9 @@ class MultistreamConnection extends EventEmitter$2 {
14892
14855
  : [{ active: false }];
14893
14856
  }
14894
14857
  createSendTransceiver(mediaType, sceneId, sendEncodingsOptions) {
14895
- let rtcTransceiver;
14858
+ let rtcRtpTransceiver;
14896
14859
  try {
14897
- rtcTransceiver = this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
14860
+ rtcRtpTransceiver = this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
14898
14861
  direction: 'sendrecv',
14899
14862
  sendEncodings: sendEncodingsOptions,
14900
14863
  });
@@ -14908,7 +14871,7 @@ class MultistreamConnection extends EventEmitter$2 {
14908
14871
  const munger = new EgressSdpMunger({
14909
14872
  doFullIce: this.options.doFullIce,
14910
14873
  });
14911
- const transceiver = new SendOnlyTransceiver(rtcTransceiver, mid, csi, munger, mediaType);
14874
+ const transceiver = new SendOnlyTransceiver({ rtcRtpTransceiver, mid, mediaType, munger, csi });
14912
14875
  if (getMediaFamily(mediaType) === exports.MediaFamily.Video) {
14913
14876
  transceiver.rtxEnabled = true;
14914
14877
  transceiver.setCodecParameters({
@@ -14990,6 +14953,10 @@ SCTP Max Message Size: ${maxMessageSize}`);
14990
14953
  jmpSession.on(JmpSessionEvents.MediaRequestStatusReceived, (data) => {
14991
14954
  logger.log(`MediaRequestStatus received: ${JSON.stringify(data)}`);
14992
14955
  data.streamStates.forEach((s) => {
14956
+ if (!isValidSsrcStreamId(s.id)) {
14957
+ logger.error(`Received MediaRequestStatus with non-SSRC based stream ID, which is currently not supported: ${JSON.stringify(s.id)}`);
14958
+ return;
14959
+ }
14993
14960
  const receiveSlot = this.getReceiveSlotById(s.id);
14994
14961
  if (!receiveSlot) {
14995
14962
  logger.warn(`Got MediaRequestStatus for unknown receive slot: ${JSON.stringify(s.id)}`);
@@ -15042,7 +15009,11 @@ SCTP Max Message Size: ${maxMessageSize}`);
15042
15009
  }
15043
15010
  const id = ids[0];
15044
15011
  const codecInfo = codecInfos[0];
15045
- const streamIdsMatched = sendTransceiver.senderIds.some((validId) => compareStreamIds(id, validId));
15012
+ if (!isValidSsrcStreamId(id)) {
15013
+ logger.warn(`${mediaType}: The stream ID is not a valid SsrcStreamId: ${JSON.stringify(id)}`);
15014
+ return;
15015
+ }
15016
+ const streamIdsMatched = sendTransceiver.senderIds.some((validId) => areStreamIdsEqual(id, validId));
15046
15017
  if (streamIdsMatched) {
15047
15018
  const encodingIndex = sendTransceiver.getEncodingIndexForStreamId(id);
15048
15019
  if (encodingIndex !== -1) {
@@ -15199,10 +15170,14 @@ SCTP Max Message Size: ${maxMessageSize}`);
15199
15170
  const rtcRtpTransceiver = this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
15200
15171
  direction: 'recvonly',
15201
15172
  });
15202
- const transceiverMid = this.midPredictor.getNextMid(mediaType);
15173
+ const mid = this.midPredictor.getNextMid(mediaType);
15203
15174
  const munger = new IngressSdpMunger();
15204
- const recvOnlyTransceiver = new ReceiveOnlyTransceiver(rtcRtpTransceiver, transceiverMid, munger);
15205
- recvOnlyTransceiver.metadata.mediaType = mediaType;
15175
+ const recvOnlyTransceiver = new ReceiveOnlyTransceiver({
15176
+ rtcRtpTransceiver,
15177
+ mid,
15178
+ mediaType,
15179
+ munger,
15180
+ });
15206
15181
  recvOnlyTransceiver.twccDisabled =
15207
15182
  getMediaFamily(mediaType) === exports.MediaFamily.Audio ? this.options.disableAudioTwcc : false;
15208
15183
  this.recvTransceivers.set(mediaType, [
@@ -15512,7 +15487,7 @@ SCTP Max Message Size: ${maxMessageSize}`);
15512
15487
  if (!slot.id) {
15513
15488
  logger.error('Running stream request task, but ReceiveSlot ID is missing.');
15514
15489
  }
15515
- if (!requestedReceiveSlotIds.some((id) => compareStreamIds(id, slot.id))) {
15490
+ if (!requestedReceiveSlotIds.some((id) => areStreamIdsEqual(id, slot.id))) {
15516
15491
  requestedReceiveSlotIds.push(slot.id);
15517
15492
  }
15518
15493
  else {
@@ -15522,8 +15497,8 @@ SCTP Max Message Size: ${maxMessageSize}`);
15522
15497
  });
15523
15498
  jmpSession.sendRequests(streamRequests.map((sr) => sr._toJmpStreamRequest()));
15524
15499
  (_a = this.recvTransceivers.get(mediaType)) === null || _a === void 0 ? void 0 : _a.forEach((transceiver) => {
15525
- if (requestedReceiveSlotIds.some((id) => compareStreamIds(id, transceiver.receiveSlot.id))) {
15526
- const relevantRequest = streamRequests.find((request) => request.receiveSlots.some((slot) => compareStreamIds(slot.id, transceiver.receiveSlot.id)));
15500
+ if (requestedReceiveSlotIds.some((id) => areStreamIdsEqual(id, transceiver.receiveSlot.id))) {
15501
+ const relevantRequest = streamRequests.find((request) => request.receiveSlots.some((slot) => areStreamIdsEqual(slot.id, transceiver.receiveSlot.id)));
15527
15502
  transceiver.handleRequested(relevantRequest);
15528
15503
  }
15529
15504
  else {
@@ -15675,7 +15650,7 @@ exports.StreamRequest = StreamRequest;
15675
15650
  exports.WcmeError = WcmeError;
15676
15651
  exports.WebRtcCoreLogger = Logger$2;
15677
15652
  exports.WebrtcCoreError = WebrtcCoreError;
15678
- exports.compareReceiveSlotIds = compareReceiveSlotIds;
15653
+ exports.areReceiveSlotIdsEqual = areReceiveSlotIdsEqual;
15679
15654
  exports.createCameraStream = createCameraStream;
15680
15655
  exports.createDisplayStream = createDisplayStream;
15681
15656
  exports.createDisplayStreamWithAudio = createDisplayStreamWithAudio;