@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 +132 -157
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +132 -157
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +21 -11
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -6442,6 +6442,10 @@ Logger$1.useDefaults({
|
|
|
6442
6442
|
},
|
|
6443
6443
|
});
|
|
6444
6444
|
|
|
6445
|
+
function areNamedMediaGroupsEqual(left, right) {
|
|
6446
|
+
return left.type === right.type && left.value === right.value;
|
|
6447
|
+
}
|
|
6448
|
+
|
|
6445
6449
|
var MediaFamily;
|
|
6446
6450
|
(function (MediaFamily) {
|
|
6447
6451
|
MediaFamily["Audio"] = "AUDIO";
|
|
@@ -6503,8 +6507,8 @@ function getMediaContent(mediaType) {
|
|
|
6503
6507
|
? MediaContent.Main
|
|
6504
6508
|
: MediaContent.Slides;
|
|
6505
6509
|
}
|
|
6506
|
-
const
|
|
6507
|
-
function
|
|
6510
|
+
const isTruthyOrZero = (value) => value === 0 || Boolean(value);
|
|
6511
|
+
function areArraysEqual(left, right, predicate) {
|
|
6508
6512
|
if (left.length !== right.length) {
|
|
6509
6513
|
return false;
|
|
6510
6514
|
}
|
|
@@ -6535,24 +6539,48 @@ function isValidActiveSpeakerInfo(msg) {
|
|
|
6535
6539
|
'crossPolicyDuplication' in maybeActiveSpeakerInfo &&
|
|
6536
6540
|
'preferLiveVideo' in maybeActiveSpeakerInfo);
|
|
6537
6541
|
}
|
|
6538
|
-
function areNamedMediaGroupArraysEqual(left, right) {
|
|
6539
|
-
if (left === undefined || right === undefined) {
|
|
6540
|
-
return left === right;
|
|
6541
|
-
}
|
|
6542
|
-
return arraysAreEqual(left, right, (l, r) => l.type === r.type && l.value === r.value);
|
|
6543
|
-
}
|
|
6544
6542
|
function areActiveSpeakerInfosEqual(left, right) {
|
|
6545
6543
|
return (left.priority === right.priority &&
|
|
6546
6544
|
left.crossPriorityDuplication === right.crossPriorityDuplication &&
|
|
6547
6545
|
left.crossPolicyDuplication === right.crossPolicyDuplication &&
|
|
6548
6546
|
left.preferLiveVideo === right.preferLiveVideo &&
|
|
6549
|
-
|
|
6547
|
+
areArraysEqual(left.namedMediaGroups || [], right.namedMediaGroups || [], areNamedMediaGroupsEqual));
|
|
6550
6548
|
}
|
|
6551
6549
|
function isValidActiveSpeakerNotificationMsg(msg) {
|
|
6552
6550
|
const maybeActiveSpeakerNotificationMsg = msg;
|
|
6553
6551
|
return Boolean(maybeActiveSpeakerNotificationMsg.seqNum && maybeActiveSpeakerNotificationMsg.csis);
|
|
6554
6552
|
}
|
|
6555
6553
|
|
|
6554
|
+
class H264Codec {
|
|
6555
|
+
constructor(maxFs, maxFps, maxMbps, maxWidth, maxHeight) {
|
|
6556
|
+
this.maxFs = maxFs;
|
|
6557
|
+
this.maxFps = maxFps;
|
|
6558
|
+
this.maxMbps = maxMbps;
|
|
6559
|
+
this.maxWidth = maxWidth;
|
|
6560
|
+
this.maxHeight = maxHeight;
|
|
6561
|
+
}
|
|
6562
|
+
}
|
|
6563
|
+
function areH264CodecsEqual(left, right) {
|
|
6564
|
+
if (left === undefined || right === undefined) {
|
|
6565
|
+
return left === right;
|
|
6566
|
+
}
|
|
6567
|
+
return (left.maxFs === right.maxFs &&
|
|
6568
|
+
left.maxFps === right.maxFps &&
|
|
6569
|
+
left.maxMbps === right.maxMbps &&
|
|
6570
|
+
left.maxWidth === right.maxWidth &&
|
|
6571
|
+
left.maxHeight === right.maxHeight);
|
|
6572
|
+
}
|
|
6573
|
+
|
|
6574
|
+
class CodecInfo$1 {
|
|
6575
|
+
constructor(payloadType, h264) {
|
|
6576
|
+
this.payloadType = payloadType;
|
|
6577
|
+
this.h264 = h264;
|
|
6578
|
+
}
|
|
6579
|
+
}
|
|
6580
|
+
function areCodecInfosEqual(left, right) {
|
|
6581
|
+
return left.payloadType === right.payloadType && areH264CodecsEqual(left.h264, right.h264);
|
|
6582
|
+
}
|
|
6583
|
+
|
|
6556
6584
|
var HomerMsgType;
|
|
6557
6585
|
(function (HomerMsgType) {
|
|
6558
6586
|
HomerMsgType["Multistream"] = "multistream";
|
|
@@ -6629,14 +6657,26 @@ function isValidMediaRequestAckMsg(msg) {
|
|
|
6629
6657
|
return Boolean(maybeMediaRequestAckMsg.mediaRequestSeqNum);
|
|
6630
6658
|
}
|
|
6631
6659
|
|
|
6632
|
-
function
|
|
6633
|
-
|
|
6634
|
-
if (maybeStreamId.mid && maybeStreamId.ssrc) {
|
|
6660
|
+
function isValidMidRidStreamId(obj) {
|
|
6661
|
+
if (typeof obj !== 'object' || obj === null)
|
|
6635
6662
|
return false;
|
|
6636
|
-
|
|
6637
|
-
return
|
|
6663
|
+
const maybeMidRidStreamId = obj;
|
|
6664
|
+
return (typeof maybeMidRidStreamId.mid === 'string' &&
|
|
6665
|
+
(maybeMidRidStreamId.rid === undefined || typeof maybeMidRidStreamId.rid === 'string') &&
|
|
6666
|
+
!('ssrc' in maybeMidRidStreamId));
|
|
6638
6667
|
}
|
|
6639
|
-
function
|
|
6668
|
+
function isValidSsrcStreamId(obj) {
|
|
6669
|
+
if (typeof obj !== 'object' || obj === null)
|
|
6670
|
+
return false;
|
|
6671
|
+
const maybeSsrcStreamId = obj;
|
|
6672
|
+
return (typeof maybeSsrcStreamId.ssrc === 'number' &&
|
|
6673
|
+
(maybeSsrcStreamId.rtxSsrc === undefined || typeof maybeSsrcStreamId.rtxSsrc === 'number') &&
|
|
6674
|
+
!('mid' in maybeSsrcStreamId));
|
|
6675
|
+
}
|
|
6676
|
+
function isValidStreamId(obj) {
|
|
6677
|
+
return isValidMidRidStreamId(obj) || isValidSsrcStreamId(obj);
|
|
6678
|
+
}
|
|
6679
|
+
function areStreamIdsEqual(id1, id2) {
|
|
6640
6680
|
const keys1 = Object.keys(id1);
|
|
6641
6681
|
const keys2 = Object.keys(id2);
|
|
6642
6682
|
if (keys1.length !== keys2.length) {
|
|
@@ -6651,6 +6691,10 @@ function isValidStreamInfo(obj) {
|
|
|
6651
6691
|
isValidStreamId(maybeStreamInfo.id) &&
|
|
6652
6692
|
['no source', 'invalid source', 'live', 'avatar', 'bandwidth disabled'].includes(maybeStreamInfo.state));
|
|
6653
6693
|
}
|
|
6694
|
+
function areStreamInfosEqual(left, right) {
|
|
6695
|
+
return (areStreamIdsEqual(left.id, right.id) && left.state === right.state && left.csi === right.csi);
|
|
6696
|
+
}
|
|
6697
|
+
|
|
6654
6698
|
class MediaRequestStatusMsg {
|
|
6655
6699
|
constructor(seqNum, streamStates) {
|
|
6656
6700
|
this.seqNum = seqNum;
|
|
@@ -6662,24 +6706,6 @@ function isValidMediaRequestStatusMsg(msg) {
|
|
|
6662
6706
|
return (Boolean(maybeMediaRequestStatusMsg.seqNum) &&
|
|
6663
6707
|
maybeMediaRequestStatusMsg.streamStates &&
|
|
6664
6708
|
maybeMediaRequestStatusMsg.streamStates.every((streamInfo) => isValidStreamInfo(streamInfo)));
|
|
6665
|
-
}
|
|
6666
|
-
function compareStreamStateArrays(streamStates1, streamStates2) {
|
|
6667
|
-
var _a, _b;
|
|
6668
|
-
if (streamStates1.length !== streamStates2.length) {
|
|
6669
|
-
return false;
|
|
6670
|
-
}
|
|
6671
|
-
for (let i = 0; i < streamStates1.length; i += 1) {
|
|
6672
|
-
if (!compareStreamIds(streamStates1[i].id, streamStates2[i].id)) {
|
|
6673
|
-
return false;
|
|
6674
|
-
}
|
|
6675
|
-
if (streamStates1[i].state !== streamStates2[i].state) {
|
|
6676
|
-
return false;
|
|
6677
|
-
}
|
|
6678
|
-
if (((_a = streamStates1[i]) === null || _a === void 0 ? void 0 : _a.csi) !== ((_b = streamStates2[i]) === null || _b === void 0 ? void 0 : _b.csi)) {
|
|
6679
|
-
return false;
|
|
6680
|
-
}
|
|
6681
|
-
}
|
|
6682
|
-
return true;
|
|
6683
6709
|
}
|
|
6684
6710
|
|
|
6685
6711
|
class MediaRequestStatusAckMsg {
|
|
@@ -6695,36 +6721,6 @@ function isValidMediaRequestStatusAckMsg(msg) {
|
|
|
6695
6721
|
return Boolean(maybeMediaRequestStatusAckMsg.mediaRequestStatusSeqNum);
|
|
6696
6722
|
}
|
|
6697
6723
|
|
|
6698
|
-
class H264Codec {
|
|
6699
|
-
constructor(maxFs, maxFps, maxMbps, maxWidth, maxHeight) {
|
|
6700
|
-
this.maxFs = maxFs;
|
|
6701
|
-
this.maxFps = maxFps;
|
|
6702
|
-
this.maxMbps = maxMbps;
|
|
6703
|
-
this.maxWidth = maxWidth;
|
|
6704
|
-
this.maxHeight = maxHeight;
|
|
6705
|
-
}
|
|
6706
|
-
}
|
|
6707
|
-
function areH264CodecsEqual(left, right) {
|
|
6708
|
-
if (left === undefined || right === undefined) {
|
|
6709
|
-
return left === right;
|
|
6710
|
-
}
|
|
6711
|
-
return (left.maxFs === right.maxFs &&
|
|
6712
|
-
left.maxFps === right.maxFps &&
|
|
6713
|
-
left.maxMbps === right.maxMbps &&
|
|
6714
|
-
left.maxWidth === right.maxWidth &&
|
|
6715
|
-
left.maxHeight === right.maxHeight);
|
|
6716
|
-
}
|
|
6717
|
-
|
|
6718
|
-
class CodecInfo$1 {
|
|
6719
|
-
constructor(payloadType, h264) {
|
|
6720
|
-
this.payloadType = payloadType;
|
|
6721
|
-
this.h264 = h264;
|
|
6722
|
-
}
|
|
6723
|
-
}
|
|
6724
|
-
function areCodecInfosEqual(left, right) {
|
|
6725
|
-
return left.payloadType === right.payloadType && areH264CodecsEqual(left.h264, right.h264);
|
|
6726
|
-
}
|
|
6727
|
-
|
|
6728
6724
|
class ReceiverSelectedInfo {
|
|
6729
6725
|
constructor(csi) {
|
|
6730
6726
|
this.csi = csi;
|
|
@@ -6741,6 +6737,22 @@ function areReceiverSelectedInfosEqual(left, right) {
|
|
|
6741
6737
|
return left.csi === right.csi;
|
|
6742
6738
|
}
|
|
6743
6739
|
|
|
6740
|
+
function arePolicySpecificInfosEqual(left, right) {
|
|
6741
|
+
if (isValidActiveSpeakerInfo(left)) {
|
|
6742
|
+
if (!isValidActiveSpeakerInfo(right)) {
|
|
6743
|
+
return false;
|
|
6744
|
+
}
|
|
6745
|
+
return areActiveSpeakerInfosEqual(left, right);
|
|
6746
|
+
}
|
|
6747
|
+
if (isValidReceiverSelectedInfo(left)) {
|
|
6748
|
+
if (!isValidReceiverSelectedInfo(right)) {
|
|
6749
|
+
return false;
|
|
6750
|
+
}
|
|
6751
|
+
return areReceiverSelectedInfosEqual(left, right);
|
|
6752
|
+
}
|
|
6753
|
+
throw new Error('Invalid PolicySpecificInfo');
|
|
6754
|
+
}
|
|
6755
|
+
|
|
6744
6756
|
class SourceAdvertisementMsg {
|
|
6745
6757
|
constructor(seqNum, numTotalSources, numLiveSources, namedMediaGroups, videoContentHint) {
|
|
6746
6758
|
this.seqNum = seqNum;
|
|
@@ -6756,28 +6768,13 @@ class SourceAdvertisementMsg {
|
|
|
6756
6768
|
function isValidSourceAdvertisementMsg(msg) {
|
|
6757
6769
|
const maybeSourceAdvertisementMsg = msg;
|
|
6758
6770
|
return Boolean(maybeSourceAdvertisementMsg.seqNum &&
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
}
|
|
6762
|
-
function compareNamedMediaGroupArrays(namedMediaGroups1, namedMediaGroups2) {
|
|
6763
|
-
var _a, _b;
|
|
6764
|
-
if (namedMediaGroups1.length !== namedMediaGroups2.length) {
|
|
6765
|
-
return false;
|
|
6766
|
-
}
|
|
6767
|
-
for (let i = 0; i < namedMediaGroups1.length; i += 1) {
|
|
6768
|
-
if (namedMediaGroups1[i].type !== namedMediaGroups2[i].type) {
|
|
6769
|
-
return false;
|
|
6770
|
-
}
|
|
6771
|
-
if (((_a = namedMediaGroups1[i]) === null || _a === void 0 ? void 0 : _a.value) !== ((_b = namedMediaGroups2[i]) === null || _b === void 0 ? void 0 : _b.value)) {
|
|
6772
|
-
return false;
|
|
6773
|
-
}
|
|
6774
|
-
}
|
|
6775
|
-
return true;
|
|
6771
|
+
isTruthyOrZero(maybeSourceAdvertisementMsg.numTotalSources) &&
|
|
6772
|
+
isTruthyOrZero(maybeSourceAdvertisementMsg.numLiveSources));
|
|
6776
6773
|
}
|
|
6777
|
-
function
|
|
6774
|
+
function areSourceAdvertisementMsgsEqual(sourceAdvertisementMsg1, sourceAdvertisementMsg2) {
|
|
6778
6775
|
return (sourceAdvertisementMsg1.numLiveSources === sourceAdvertisementMsg2.numLiveSources &&
|
|
6779
6776
|
sourceAdvertisementMsg1.numTotalSources === sourceAdvertisementMsg2.numTotalSources &&
|
|
6780
|
-
|
|
6777
|
+
areArraysEqual(sourceAdvertisementMsg1.namedMediaGroups || [], sourceAdvertisementMsg2.namedMediaGroups || [], areNamedMediaGroupsEqual) &&
|
|
6781
6778
|
sourceAdvertisementMsg1.videoContentHint === sourceAdvertisementMsg2.videoContentHint);
|
|
6782
6779
|
}
|
|
6783
6780
|
|
|
@@ -6806,27 +6803,6 @@ class StreamRequest$1 {
|
|
|
6806
6803
|
return `Request(policy=${this.policy}, info=${this.policySpecificInfo}, ids=[${this.ids}], maxPayloadBitsPerSecond=[${this.maxPayloadBitsPerSecond}], codecInfos=[${this.codecInfos}])`;
|
|
6807
6804
|
}
|
|
6808
6805
|
}
|
|
6809
|
-
function arePolicySpecificInfosEqual(left, right) {
|
|
6810
|
-
if (isValidActiveSpeakerInfo(left)) {
|
|
6811
|
-
if (!isValidActiveSpeakerInfo(right)) {
|
|
6812
|
-
return false;
|
|
6813
|
-
}
|
|
6814
|
-
return areActiveSpeakerInfosEqual(left, right);
|
|
6815
|
-
}
|
|
6816
|
-
if (isValidReceiverSelectedInfo(left)) {
|
|
6817
|
-
if (!isValidReceiverSelectedInfo(right)) {
|
|
6818
|
-
return false;
|
|
6819
|
-
}
|
|
6820
|
-
return areReceiverSelectedInfosEqual(left, right);
|
|
6821
|
-
}
|
|
6822
|
-
throw new Error('Invalid PolicySpecificInfo');
|
|
6823
|
-
}
|
|
6824
|
-
function areCodecInfoArraysEqual(left, right) {
|
|
6825
|
-
return arraysAreEqual(left, right, areCodecInfosEqual);
|
|
6826
|
-
}
|
|
6827
|
-
function areStreamIdArraysEqual(left, right) {
|
|
6828
|
-
return arraysAreEqual(left, right, compareStreamIds);
|
|
6829
|
-
}
|
|
6830
6806
|
function areStreamRequestsEqual(left, right) {
|
|
6831
6807
|
if (left.policy !== right.policy) {
|
|
6832
6808
|
return false;
|
|
@@ -6834,16 +6810,13 @@ function areStreamRequestsEqual(left, right) {
|
|
|
6834
6810
|
if (!arePolicySpecificInfosEqual(left.policySpecificInfo, right.policySpecificInfo)) {
|
|
6835
6811
|
return false;
|
|
6836
6812
|
}
|
|
6837
|
-
if (!
|
|
6813
|
+
if (!areArraysEqual(left.ids, right.ids, areStreamIdsEqual)) {
|
|
6838
6814
|
return false;
|
|
6839
6815
|
}
|
|
6840
6816
|
if (left.maxPayloadBitsPerSecond !== right.maxPayloadBitsPerSecond) {
|
|
6841
6817
|
return false;
|
|
6842
6818
|
}
|
|
6843
|
-
|
|
6844
|
-
return false;
|
|
6845
|
-
}
|
|
6846
|
-
return true;
|
|
6819
|
+
return areArraysEqual(left.codecInfos, right.codecInfos, areCodecInfosEqual);
|
|
6847
6820
|
}
|
|
6848
6821
|
|
|
6849
6822
|
class RetransmitHandler {
|
|
@@ -6885,17 +6858,6 @@ var JmpSessionEvents;
|
|
|
6885
6858
|
JmpSessionEvents["MediaRequestStatusReceived"] = "media-request-status-received";
|
|
6886
6859
|
JmpSessionEvents["SourceAdvertisementReceived"] = "source-advertisement-received";
|
|
6887
6860
|
})(JmpSessionEvents || (JmpSessionEvents = {}));
|
|
6888
|
-
function areStreamRequestArraysEqual(left, right) {
|
|
6889
|
-
if (left.length !== right.length) {
|
|
6890
|
-
return false;
|
|
6891
|
-
}
|
|
6892
|
-
for (let i = 0; i < left.length; i += 1) {
|
|
6893
|
-
if (!areStreamRequestsEqual(left[i], right[i])) {
|
|
6894
|
-
return false;
|
|
6895
|
-
}
|
|
6896
|
-
}
|
|
6897
|
-
return true;
|
|
6898
|
-
}
|
|
6899
6861
|
class JmpSession extends EventEmitter$5 {
|
|
6900
6862
|
constructor(mediaFamily, mediaContent, maxNumRetransmits = 200, retransmitIntervalMs = 250) {
|
|
6901
6863
|
super();
|
|
@@ -6919,7 +6881,7 @@ class JmpSession extends EventEmitter$5 {
|
|
|
6919
6881
|
var _a;
|
|
6920
6882
|
const mediaRequestMsg = new MediaRequestMsg(this.currMediaRequestSeqNum, requests);
|
|
6921
6883
|
if (!this.lastSentMediaRequest ||
|
|
6922
|
-
!
|
|
6884
|
+
!areArraysEqual(this.lastSentMediaRequest.msg.requests, requests, areStreamRequestsEqual)) {
|
|
6923
6885
|
this.sendJmpMsg(JmpMsgType.MediaRequest, mediaRequestMsg);
|
|
6924
6886
|
(_a = this.lastSentMediaRequest) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
6925
6887
|
this.lastSentMediaRequest = new RetransmitHandler(mediaRequestMsg, this.maxNumRetransmits, this.retransmitIntervalMs, () => {
|
|
@@ -6938,7 +6900,7 @@ class JmpSession extends EventEmitter$5 {
|
|
|
6938
6900
|
var _a;
|
|
6939
6901
|
const sourceAdvertisementMsg = new SourceAdvertisementMsg(this.currSourceAdvertisementSeqNum, numTotalSources, numLiveSources, namedMediaGroups, videoContentHint);
|
|
6940
6902
|
if (!this.lastSentSourceAdvertisement ||
|
|
6941
|
-
!
|
|
6903
|
+
!areSourceAdvertisementMsgsEqual(this.lastSentSourceAdvertisement.msg, sourceAdvertisementMsg)) {
|
|
6942
6904
|
this.sendJmpMsg(JmpMsgType.SourceAdvertisement, sourceAdvertisementMsg);
|
|
6943
6905
|
(_a = this.lastSentSourceAdvertisement) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
6944
6906
|
this.lastSentSourceAdvertisement = new RetransmitHandler(sourceAdvertisementMsg, this.maxNumRetransmits, this.retransmitIntervalMs, () => {
|
|
@@ -6957,11 +6919,11 @@ class JmpSession extends EventEmitter$5 {
|
|
|
6957
6919
|
var _a, _b;
|
|
6958
6920
|
const filteredStreamStates = streamStates.filter((streamState) => {
|
|
6959
6921
|
var _a;
|
|
6960
|
-
return (_a = this.lastReceivedMediaRequest) === null || _a === void 0 ? void 0 : _a.requests.some((req) => req.ids.find((streamId) =>
|
|
6922
|
+
return (_a = this.lastReceivedMediaRequest) === null || _a === void 0 ? void 0 : _a.requests.some((req) => req.ids.find((streamId) => areStreamIdsEqual(streamId, streamState.id)));
|
|
6961
6923
|
});
|
|
6962
6924
|
const mediaRequestStatus = new MediaRequestStatusMsg(this.currMediaRequestStatusSeqNum, filteredStreamStates);
|
|
6963
6925
|
if (!((_a = this.lastSentMediaRequestStatus) === null || _a === void 0 ? void 0 : _a.msg.streamStates) ||
|
|
6964
|
-
!
|
|
6926
|
+
!areArraysEqual(filteredStreamStates, this.lastSentMediaRequestStatus.msg.streamStates, areStreamInfosEqual)) {
|
|
6965
6927
|
this.sendJmpMsg(JmpMsgType.MediaRequestStatus, mediaRequestStatus);
|
|
6966
6928
|
(_b = this.lastSentMediaRequestStatus) === null || _b === void 0 ? void 0 : _b.cancel();
|
|
6967
6929
|
this.lastSentMediaRequestStatus = new RetransmitHandler(mediaRequestStatus, this.maxNumRetransmits, this.retransmitIntervalMs, () => {
|
|
@@ -9822,7 +9784,7 @@ class EgressSdpMunger {
|
|
|
9822
9784
|
const simulcastSsrcs = (_a = mediaDescription.ssrcGroups.find((sg) => sg.semantics === 'SIM')) === null || _a === void 0 ? void 0 : _a.ssrcs;
|
|
9823
9785
|
if (simulcastSsrcs) {
|
|
9824
9786
|
if (simulcastSsrcs.length !== numStreams ||
|
|
9825
|
-
!this.streamIds.every((
|
|
9787
|
+
!this.streamIds.every(({ ssrc }) => simulcastSsrcs.includes(ssrc))) {
|
|
9826
9788
|
logErrorAndThrow(WcmeErrorType.SDP_MUNGE_FAILED, 'SSRCs in simulcast SSRC group do not match primary SSRCs in RTX SSRC groups.');
|
|
9827
9789
|
}
|
|
9828
9790
|
this.streamIds.sort((a, b) => simulcastSsrcs.indexOf(a.ssrc) - simulcastSsrcs.indexOf(b.ssrc));
|
|
@@ -9853,10 +9815,12 @@ class EgressSdpMunger {
|
|
|
9853
9815
|
mediaDescription.addLine(new SsrcLine(rtpSsrc, 'cname', `${rtpSsrc}-cname`));
|
|
9854
9816
|
mediaDescription.addLine(new SsrcLine(rtpSsrc, 'msid', '-', `${mediaDescription.mid}`));
|
|
9855
9817
|
if (options.rtxEnabled) {
|
|
9856
|
-
const rtxSsrc = streamId
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9818
|
+
const { rtxSsrc } = streamId;
|
|
9819
|
+
if (rtxSsrc) {
|
|
9820
|
+
mediaDescription.addLine(new SsrcLine(rtxSsrc, 'cname', `${rtpSsrc}-cname`));
|
|
9821
|
+
mediaDescription.addLine(new SsrcLine(rtxSsrc, 'msid', '-', `${mediaDescription.mid}`));
|
|
9822
|
+
mediaDescription.addLine(new SsrcGroupLine('FID', [rtpSsrc, rtxSsrc]));
|
|
9823
|
+
}
|
|
9860
9824
|
}
|
|
9861
9825
|
});
|
|
9862
9826
|
if (options.simulcastEnabled) {
|
|
@@ -9895,7 +9859,7 @@ class EgressSdpMunger {
|
|
|
9895
9859
|
return this.streamIds;
|
|
9896
9860
|
}
|
|
9897
9861
|
getEncodingIndexForStreamId(streamId) {
|
|
9898
|
-
return this.streamIds.findIndex((currStreamId) =>
|
|
9862
|
+
return this.streamIds.findIndex((currStreamId) => areStreamIdsEqual(currStreamId, streamId));
|
|
9899
9863
|
}
|
|
9900
9864
|
setCodecParameters(parameters) {
|
|
9901
9865
|
Object.entries(parameters).forEach(([param, value]) => {
|
|
@@ -10493,8 +10457,8 @@ class OveruseStateManager {
|
|
|
10493
10457
|
}
|
|
10494
10458
|
}
|
|
10495
10459
|
|
|
10496
|
-
function
|
|
10497
|
-
return
|
|
10460
|
+
function areReceiveSlotIdsEqual(id1, id2) {
|
|
10461
|
+
return areStreamIdsEqual(id1, id2);
|
|
10498
10462
|
}
|
|
10499
10463
|
var ReceiveSlotEvents;
|
|
10500
10464
|
(function (ReceiveSlotEvents) {
|
|
@@ -10574,10 +10538,11 @@ class StatsManager {
|
|
|
10574
10538
|
}
|
|
10575
10539
|
|
|
10576
10540
|
class Transceiver {
|
|
10577
|
-
constructor(
|
|
10541
|
+
constructor(config) {
|
|
10578
10542
|
this.twccDisabled = false;
|
|
10579
|
-
this._rtcRtpTransceiver = rtcRtpTransceiver;
|
|
10580
|
-
this.mid = mid;
|
|
10543
|
+
this._rtcRtpTransceiver = config.rtcRtpTransceiver;
|
|
10544
|
+
this.mid = config.mid;
|
|
10545
|
+
this.mediaType = config.mediaType;
|
|
10581
10546
|
}
|
|
10582
10547
|
replaceTransceiver(newRtcRtpTransceiver) {
|
|
10583
10548
|
this._rtcRtpTransceiver = newRtcRtpTransceiver;
|
|
@@ -10594,10 +10559,10 @@ class Transceiver {
|
|
|
10594
10559
|
}
|
|
10595
10560
|
|
|
10596
10561
|
class ReceiveOnlyTransceiver extends Transceiver {
|
|
10597
|
-
constructor(
|
|
10598
|
-
super(
|
|
10562
|
+
constructor(config) {
|
|
10563
|
+
super(config);
|
|
10599
10564
|
this.metadata = { isRequested: false, isActiveSpeaker: false };
|
|
10600
|
-
this.munger = munger;
|
|
10565
|
+
this.munger = config.munger;
|
|
10601
10566
|
this._receiveSlot = new ReceiveSlot(() => {
|
|
10602
10567
|
if (!this._rtcRtpTransceiver.mid) {
|
|
10603
10568
|
return null;
|
|
@@ -10625,7 +10590,7 @@ class ReceiveOnlyTransceiver extends Transceiver {
|
|
|
10625
10590
|
stats.mid = this.mid;
|
|
10626
10591
|
stats.csi = this.receiveSlot.currentRxCsi;
|
|
10627
10592
|
stats.sourceState = this.receiveSlot.sourceState;
|
|
10628
|
-
stats.calliopeMediaType = this.
|
|
10593
|
+
stats.calliopeMediaType = this.mediaType;
|
|
10629
10594
|
stats.requestedBitrate = this.metadata.requestedBitrate;
|
|
10630
10595
|
stats.requestedFrameSize = this.metadata.requestedFrameSize;
|
|
10631
10596
|
stats.isRequested = this.metadata.isRequested;
|
|
@@ -14393,8 +14358,8 @@ var OfferAnswerType;
|
|
|
14393
14358
|
OfferAnswerType[OfferAnswerType["Remote"] = 1] = "Remote";
|
|
14394
14359
|
})(OfferAnswerType || (OfferAnswerType = {}));
|
|
14395
14360
|
class SendOnlyTransceiver extends Transceiver {
|
|
14396
|
-
constructor(
|
|
14397
|
-
super(
|
|
14361
|
+
constructor(config) {
|
|
14362
|
+
super(config);
|
|
14398
14363
|
this.rtxEnabled = false;
|
|
14399
14364
|
this.streamMuteStateChange = new TypedEvent();
|
|
14400
14365
|
this.streamPublishStateChange = new TypedEvent();
|
|
@@ -14403,13 +14368,12 @@ class SendOnlyTransceiver extends Transceiver {
|
|
|
14403
14368
|
this.requestedIdEncodingParamsMap = new Map();
|
|
14404
14369
|
this.updateSendParametersQueue = new AsyncQueue();
|
|
14405
14370
|
this.metadata = { lastRequestedUpdateTimestampsMap: new Map() };
|
|
14406
|
-
this.
|
|
14371
|
+
this.munger = config.munger;
|
|
14372
|
+
this.csi = config.csi;
|
|
14407
14373
|
this.direction = 'sendrecv';
|
|
14408
14374
|
this.handleTrackChange = this.handleTrackChange.bind(this);
|
|
14409
14375
|
this.handleStreamConstraintsChange = this.handleStreamConstraintsChange.bind(this);
|
|
14410
14376
|
this.handleStreamMuteStateChange = this.handleStreamMuteStateChange.bind(this);
|
|
14411
|
-
this.munger = munger;
|
|
14412
|
-
this.mediaType = mediaType;
|
|
14413
14377
|
}
|
|
14414
14378
|
replaceSenderSource(stream) {
|
|
14415
14379
|
var _a, _b;
|
|
@@ -14730,13 +14694,12 @@ const organizeTransceiverStats = (sendTransceivers, recvTransceivers) => __await
|
|
|
14730
14694
|
})));
|
|
14731
14695
|
yield Promise.all([...recvTransceivers.entries()].map(([mediaType, transceivers]) => __awaiter$1(void 0, void 0, void 0, function* () {
|
|
14732
14696
|
return Promise.all(transceivers.map((t) => __awaiter$1(void 0, void 0, void 0, function* () {
|
|
14733
|
-
var _b
|
|
14697
|
+
var _b;
|
|
14734
14698
|
const item = {
|
|
14735
14699
|
report: yield t.getStats(),
|
|
14736
|
-
mid: (_b = t.receiveSlot.id) === null || _b === void 0 ? void 0 : _b.mid,
|
|
14737
14700
|
csi: t.receiveSlot.currentRxCsi,
|
|
14738
14701
|
currentDirection: 'recvonly',
|
|
14739
|
-
localTrackLabel: (
|
|
14702
|
+
localTrackLabel: (_b = t.receiveSlot.stream.getTracks()[0]) === null || _b === void 0 ? void 0 : _b.label,
|
|
14740
14703
|
};
|
|
14741
14704
|
if (mediaType === MediaType.AudioMain) {
|
|
14742
14705
|
result.audio.receivers.push(item);
|
|
@@ -14888,9 +14851,9 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
14888
14851
|
: [{ active: false }];
|
|
14889
14852
|
}
|
|
14890
14853
|
createSendTransceiver(mediaType, sceneId, sendEncodingsOptions) {
|
|
14891
|
-
let
|
|
14854
|
+
let rtcRtpTransceiver;
|
|
14892
14855
|
try {
|
|
14893
|
-
|
|
14856
|
+
rtcRtpTransceiver = this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
|
|
14894
14857
|
direction: 'sendrecv',
|
|
14895
14858
|
sendEncodings: sendEncodingsOptions,
|
|
14896
14859
|
});
|
|
@@ -14904,7 +14867,7 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
14904
14867
|
const munger = new EgressSdpMunger({
|
|
14905
14868
|
doFullIce: this.options.doFullIce,
|
|
14906
14869
|
});
|
|
14907
|
-
const transceiver = new SendOnlyTransceiver(
|
|
14870
|
+
const transceiver = new SendOnlyTransceiver({ rtcRtpTransceiver, mid, mediaType, munger, csi });
|
|
14908
14871
|
if (getMediaFamily(mediaType) === MediaFamily.Video) {
|
|
14909
14872
|
transceiver.rtxEnabled = true;
|
|
14910
14873
|
transceiver.setCodecParameters({
|
|
@@ -14986,6 +14949,10 @@ SCTP Max Message Size: ${maxMessageSize}`);
|
|
|
14986
14949
|
jmpSession.on(JmpSessionEvents.MediaRequestStatusReceived, (data) => {
|
|
14987
14950
|
logger.log(`MediaRequestStatus received: ${JSON.stringify(data)}`);
|
|
14988
14951
|
data.streamStates.forEach((s) => {
|
|
14952
|
+
if (!isValidSsrcStreamId(s.id)) {
|
|
14953
|
+
logger.error(`Received MediaRequestStatus with non-SSRC based stream ID, which is currently not supported: ${JSON.stringify(s.id)}`);
|
|
14954
|
+
return;
|
|
14955
|
+
}
|
|
14989
14956
|
const receiveSlot = this.getReceiveSlotById(s.id);
|
|
14990
14957
|
if (!receiveSlot) {
|
|
14991
14958
|
logger.warn(`Got MediaRequestStatus for unknown receive slot: ${JSON.stringify(s.id)}`);
|
|
@@ -15038,7 +15005,11 @@ SCTP Max Message Size: ${maxMessageSize}`);
|
|
|
15038
15005
|
}
|
|
15039
15006
|
const id = ids[0];
|
|
15040
15007
|
const codecInfo = codecInfos[0];
|
|
15041
|
-
|
|
15008
|
+
if (!isValidSsrcStreamId(id)) {
|
|
15009
|
+
logger.warn(`${mediaType}: The stream ID is not a valid SsrcStreamId: ${JSON.stringify(id)}`);
|
|
15010
|
+
return;
|
|
15011
|
+
}
|
|
15012
|
+
const streamIdsMatched = sendTransceiver.senderIds.some((validId) => areStreamIdsEqual(id, validId));
|
|
15042
15013
|
if (streamIdsMatched) {
|
|
15043
15014
|
const encodingIndex = sendTransceiver.getEncodingIndexForStreamId(id);
|
|
15044
15015
|
if (encodingIndex !== -1) {
|
|
@@ -15195,10 +15166,14 @@ SCTP Max Message Size: ${maxMessageSize}`);
|
|
|
15195
15166
|
const rtcRtpTransceiver = this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
|
|
15196
15167
|
direction: 'recvonly',
|
|
15197
15168
|
});
|
|
15198
|
-
const
|
|
15169
|
+
const mid = this.midPredictor.getNextMid(mediaType);
|
|
15199
15170
|
const munger = new IngressSdpMunger();
|
|
15200
|
-
const recvOnlyTransceiver = new ReceiveOnlyTransceiver(
|
|
15201
|
-
|
|
15171
|
+
const recvOnlyTransceiver = new ReceiveOnlyTransceiver({
|
|
15172
|
+
rtcRtpTransceiver,
|
|
15173
|
+
mid,
|
|
15174
|
+
mediaType,
|
|
15175
|
+
munger,
|
|
15176
|
+
});
|
|
15202
15177
|
recvOnlyTransceiver.twccDisabled =
|
|
15203
15178
|
getMediaFamily(mediaType) === MediaFamily.Audio ? this.options.disableAudioTwcc : false;
|
|
15204
15179
|
this.recvTransceivers.set(mediaType, [
|
|
@@ -15508,7 +15483,7 @@ SCTP Max Message Size: ${maxMessageSize}`);
|
|
|
15508
15483
|
if (!slot.id) {
|
|
15509
15484
|
logger.error('Running stream request task, but ReceiveSlot ID is missing.');
|
|
15510
15485
|
}
|
|
15511
|
-
if (!requestedReceiveSlotIds.some((id) =>
|
|
15486
|
+
if (!requestedReceiveSlotIds.some((id) => areStreamIdsEqual(id, slot.id))) {
|
|
15512
15487
|
requestedReceiveSlotIds.push(slot.id);
|
|
15513
15488
|
}
|
|
15514
15489
|
else {
|
|
@@ -15518,8 +15493,8 @@ SCTP Max Message Size: ${maxMessageSize}`);
|
|
|
15518
15493
|
});
|
|
15519
15494
|
jmpSession.sendRequests(streamRequests.map((sr) => sr._toJmpStreamRequest()));
|
|
15520
15495
|
(_a = this.recvTransceivers.get(mediaType)) === null || _a === void 0 ? void 0 : _a.forEach((transceiver) => {
|
|
15521
|
-
if (requestedReceiveSlotIds.some((id) =>
|
|
15522
|
-
const relevantRequest = streamRequests.find((request) => request.receiveSlots.some((slot) =>
|
|
15496
|
+
if (requestedReceiveSlotIds.some((id) => areStreamIdsEqual(id, transceiver.receiveSlot.id))) {
|
|
15497
|
+
const relevantRequest = streamRequests.find((request) => request.receiveSlots.some((slot) => areStreamIdsEqual(slot.id, transceiver.receiveSlot.id)));
|
|
15523
15498
|
transceiver.handleRequested(relevantRequest);
|
|
15524
15499
|
}
|
|
15525
15500
|
else {
|
|
@@ -15650,5 +15625,5 @@ class StreamRequest {
|
|
|
15650
15625
|
|
|
15651
15626
|
const { DeviceKind } = media;
|
|
15652
15627
|
|
|
15653
|
-
export { ActiveSpeakerInfo, CodecInfo$1 as CodecInfo, ConnectionState, DeviceKind, H264Codec, Logger$1 as JMPLogger, LocalCameraStream, LocalDisplayStream, LocalMicrophoneStream, LocalStream, LocalStreamEventNames, LocalSystemAudioStream, Logger, MediaCodecMimeType, MediaContent, MediaFamily, MediaStreamTrackKind, MediaType, MultistreamConnection, MultistreamConnectionEventNames, PeerConnection, Policy, ReceiveSlot, ReceiveSlotEvents, ReceiverSelectedInfo, RecommendedOpusBitrates, RemoteMediaState, RemoteStream, RemoteStreamEventNames, SendSlot, StreamEventNames, StreamRequest, WcmeError, WcmeErrorType, Logger$2 as WebRtcCoreLogger, WebrtcCoreError, WebrtcCoreErrorType,
|
|
15628
|
+
export { ActiveSpeakerInfo, CodecInfo$1 as CodecInfo, ConnectionState, DeviceKind, H264Codec, Logger$1 as JMPLogger, LocalCameraStream, LocalDisplayStream, LocalMicrophoneStream, LocalStream, LocalStreamEventNames, LocalSystemAudioStream, Logger, MediaCodecMimeType, MediaContent, MediaFamily, MediaStreamTrackKind, MediaType, MultistreamConnection, MultistreamConnectionEventNames, PeerConnection, Policy, ReceiveSlot, ReceiveSlotEvents, ReceiverSelectedInfo, RecommendedOpusBitrates, RemoteMediaState, RemoteStream, RemoteStreamEventNames, SendSlot, StreamEventNames, StreamRequest, WcmeError, WcmeErrorType, Logger$2 as WebRtcCoreLogger, WebrtcCoreError, WebrtcCoreErrorType, areReceiveSlotIdsEqual, createCameraStream, createDisplayStream, createDisplayStreamWithAudio, createMicrophoneStream, getAudioInputDevices, getAudioOutputDevices, getDevices, getLogLevel, getMediaContent, getMediaFamily, getMediaType, getRecommendedMaxBitrateForFrameSize, getVideoInputDevices, logErrorAndThrow, setLogHandler, setLogLevel, setOnDeviceChangeHandler };
|
|
15654
15629
|
//# sourceMappingURL=index.js.map
|