@webex/web-client-media-engine 1.37.1 → 1.37.2
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 +39 -11
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +39 -11
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +4 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -8773,17 +8773,25 @@ function setMaxBandwidth(parsedSdp, maxBandwidth) {
|
|
|
8773
8773
|
mline.bandwidth = new BandwidthLine('TIAS', maxBandwidth);
|
|
8774
8774
|
});
|
|
8775
8775
|
}
|
|
8776
|
-
function setupBundle(parsedSdp, bundlePolicy) {
|
|
8776
|
+
function setupBundle(parsedSdp, bundlePolicy, midMap) {
|
|
8777
8777
|
if (bundlePolicy === 'max-compat') {
|
|
8778
|
-
const
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
const
|
|
8782
|
-
.filter((m) => m.type === 'video')
|
|
8783
|
-
.map((m) => m.mid);
|
|
8778
|
+
const audioMainMids = midMap.get(MediaType.AudioMain);
|
|
8779
|
+
const videoMainMids = midMap.get(MediaType.VideoMain);
|
|
8780
|
+
const audioContentMids = midMap.get(MediaType.AudioSlides);
|
|
8781
|
+
const videoContentMids = midMap.get(MediaType.VideoSlides);
|
|
8784
8782
|
parsedSdp.session.groups.splice(0, parsedSdp.session.groups.length);
|
|
8785
|
-
|
|
8786
|
-
|
|
8783
|
+
if (audioMainMids) {
|
|
8784
|
+
parsedSdp.session.groups.push(new BundleGroupLine(audioMainMids));
|
|
8785
|
+
}
|
|
8786
|
+
if (videoMainMids) {
|
|
8787
|
+
parsedSdp.session.groups.push(new BundleGroupLine(videoMainMids));
|
|
8788
|
+
}
|
|
8789
|
+
if (audioContentMids) {
|
|
8790
|
+
parsedSdp.session.groups.push(new BundleGroupLine(audioContentMids));
|
|
8791
|
+
}
|
|
8792
|
+
if (videoContentMids) {
|
|
8793
|
+
parsedSdp.session.groups.push(new BundleGroupLine(videoContentMids));
|
|
8794
|
+
}
|
|
8787
8795
|
}
|
|
8788
8796
|
}
|
|
8789
8797
|
function filterRecvOnlyMlines(parsedSdp) {
|
|
@@ -9575,6 +9583,8 @@ class MultistreamConnection extends EventEmitter {
|
|
|
9575
9583
|
this.pendingJmpTasks = [];
|
|
9576
9584
|
this.metricsCallback = () => { };
|
|
9577
9585
|
this.overuseUpdateCallback = () => { };
|
|
9586
|
+
this.midMap = new Map();
|
|
9587
|
+
this.currentMid = 0;
|
|
9578
9588
|
this.options = Object.assign(Object.assign({}, defaultMultistreamConnectionOptions), userOptions);
|
|
9579
9589
|
logger.info(`Creating multistream connection with options ${JSON.stringify(this.options)}`);
|
|
9580
9590
|
this.initializePeerConnection();
|
|
@@ -9593,6 +9603,16 @@ class MultistreamConnection extends EventEmitter {
|
|
|
9593
9603
|
this.createSendTransceiver(MediaType.AudioSlides, contentSceneId);
|
|
9594
9604
|
}
|
|
9595
9605
|
}
|
|
9606
|
+
addMid(mediaType) {
|
|
9607
|
+
const mid = this.currentMid++;
|
|
9608
|
+
const mids = this.midMap.get(mediaType) || [];
|
|
9609
|
+
mids.push(`${mid}`);
|
|
9610
|
+
this.midMap.set(mediaType, mids);
|
|
9611
|
+
}
|
|
9612
|
+
clearMids() {
|
|
9613
|
+
this.midMap = new Map();
|
|
9614
|
+
this.currentMid = 0;
|
|
9615
|
+
}
|
|
9596
9616
|
initializePeerConnection() {
|
|
9597
9617
|
var _a;
|
|
9598
9618
|
(_a = this.pc) === null || _a === void 0 ? void 0 : _a.close();
|
|
@@ -9621,6 +9641,7 @@ class MultistreamConnection extends EventEmitter {
|
|
|
9621
9641
|
direction: 'sendrecv',
|
|
9622
9642
|
sendEncodings: sendEncodingsOptions,
|
|
9623
9643
|
});
|
|
9644
|
+
this.addMid(mediaType);
|
|
9624
9645
|
const csi = generateCsi(getMediaFamily(mediaType), sceneId);
|
|
9625
9646
|
this.sendTransceivers.set(mediaType, new SendOnlyTransceiver(rtcTransceiver, csi));
|
|
9626
9647
|
this.createJmpSession(mediaType);
|
|
@@ -9900,6 +9921,7 @@ class MultistreamConnection extends EventEmitter {
|
|
|
9900
9921
|
const rtcRtpTransceiver = this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
|
|
9901
9922
|
direction: 'recvonly',
|
|
9902
9923
|
});
|
|
9924
|
+
this.addMid(mediaType);
|
|
9903
9925
|
const recvOnlyTransceiver = new ReceiveOnlyTransceiver(rtcRtpTransceiver, (mid) => {
|
|
9904
9926
|
const ingressSignaler = this.streamSignalerManager.getIngressStreamSignaler(mid);
|
|
9905
9927
|
if (!ingressSignaler) {
|
|
@@ -9963,6 +9985,9 @@ class MultistreamConnection extends EventEmitter {
|
|
|
9963
9985
|
}
|
|
9964
9986
|
createOffer() {
|
|
9965
9987
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9988
|
+
if (!this.pc.getLocalDescription()) {
|
|
9989
|
+
this.currentMid++;
|
|
9990
|
+
}
|
|
9966
9991
|
return (this.pc
|
|
9967
9992
|
.createOffer()
|
|
9968
9993
|
.then((offer) => {
|
|
@@ -10022,7 +10047,7 @@ class MultistreamConnection extends EventEmitter {
|
|
|
10022
10047
|
}
|
|
10023
10048
|
});
|
|
10024
10049
|
if (getBrowserDetails().name !== 'Firefox') {
|
|
10025
|
-
setupBundle(parsed, this.options.bundlePolicy);
|
|
10050
|
+
setupBundle(parsed, this.options.bundlePolicy, this.midMap);
|
|
10026
10051
|
}
|
|
10027
10052
|
return parsed.toString();
|
|
10028
10053
|
}
|
|
@@ -10057,7 +10082,7 @@ class MultistreamConnection extends EventEmitter {
|
|
|
10057
10082
|
const parsedOffer = parse((_a = this.pc.getLocalDescription()) === null || _a === void 0 ? void 0 : _a.sdp);
|
|
10058
10083
|
matchMlinesInAnswer(parsedOffer, parsedAnswer, this.streamSignalerManager);
|
|
10059
10084
|
if (getBrowserDetails().name === 'Firefox') {
|
|
10060
|
-
setupBundle(parsedAnswer, this.options.bundlePolicy);
|
|
10085
|
+
setupBundle(parsedAnswer, this.options.bundlePolicy, this.midMap);
|
|
10061
10086
|
}
|
|
10062
10087
|
return parsedAnswer.toString();
|
|
10063
10088
|
}
|
|
@@ -10099,11 +10124,13 @@ class MultistreamConnection extends EventEmitter {
|
|
|
10099
10124
|
this.options = Object.assign(Object.assign({}, defaultMultistreamConnectionOptions), userOptions);
|
|
10100
10125
|
}
|
|
10101
10126
|
logger.info(`Renewing multistream connection with options ${JSON.stringify(this.options)}`);
|
|
10127
|
+
this.clearMids();
|
|
10102
10128
|
this.initializePeerConnection();
|
|
10103
10129
|
this.streamSignalerManager = new StreamSignalerManager(this.options.streamSignalingMode);
|
|
10104
10130
|
const mainSceneId = generateSceneId();
|
|
10105
10131
|
this.sendTransceivers.forEach((transceiver, mediaType) => {
|
|
10106
10132
|
var _a;
|
|
10133
|
+
this.addMid(mediaType);
|
|
10107
10134
|
transceiver.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
|
|
10108
10135
|
direction: 'sendrecv',
|
|
10109
10136
|
sendEncodings: getMediaFamily(mediaType) === MediaFamily.Video
|
|
@@ -10119,6 +10146,7 @@ class MultistreamConnection extends EventEmitter {
|
|
|
10119
10146
|
});
|
|
10120
10147
|
this.recvTransceivers.forEach((transceivers, mediaType) => {
|
|
10121
10148
|
transceivers.forEach((t) => {
|
|
10149
|
+
this.addMid(mediaType);
|
|
10122
10150
|
t.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
|
|
10123
10151
|
direction: 'recvonly',
|
|
10124
10152
|
}));
|