@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/esm/index.js
CHANGED
|
@@ -8769,17 +8769,25 @@ function setMaxBandwidth(parsedSdp, maxBandwidth) {
|
|
|
8769
8769
|
mline.bandwidth = new BandwidthLine('TIAS', maxBandwidth);
|
|
8770
8770
|
});
|
|
8771
8771
|
}
|
|
8772
|
-
function setupBundle(parsedSdp, bundlePolicy) {
|
|
8772
|
+
function setupBundle(parsedSdp, bundlePolicy, midMap) {
|
|
8773
8773
|
if (bundlePolicy === 'max-compat') {
|
|
8774
|
-
const
|
|
8775
|
-
|
|
8776
|
-
|
|
8777
|
-
const
|
|
8778
|
-
.filter((m) => m.type === 'video')
|
|
8779
|
-
.map((m) => m.mid);
|
|
8774
|
+
const audioMainMids = midMap.get(MediaType.AudioMain);
|
|
8775
|
+
const videoMainMids = midMap.get(MediaType.VideoMain);
|
|
8776
|
+
const audioContentMids = midMap.get(MediaType.AudioSlides);
|
|
8777
|
+
const videoContentMids = midMap.get(MediaType.VideoSlides);
|
|
8780
8778
|
parsedSdp.session.groups.splice(0, parsedSdp.session.groups.length);
|
|
8781
|
-
|
|
8782
|
-
|
|
8779
|
+
if (audioMainMids) {
|
|
8780
|
+
parsedSdp.session.groups.push(new BundleGroupLine(audioMainMids));
|
|
8781
|
+
}
|
|
8782
|
+
if (videoMainMids) {
|
|
8783
|
+
parsedSdp.session.groups.push(new BundleGroupLine(videoMainMids));
|
|
8784
|
+
}
|
|
8785
|
+
if (audioContentMids) {
|
|
8786
|
+
parsedSdp.session.groups.push(new BundleGroupLine(audioContentMids));
|
|
8787
|
+
}
|
|
8788
|
+
if (videoContentMids) {
|
|
8789
|
+
parsedSdp.session.groups.push(new BundleGroupLine(videoContentMids));
|
|
8790
|
+
}
|
|
8783
8791
|
}
|
|
8784
8792
|
}
|
|
8785
8793
|
function filterRecvOnlyMlines(parsedSdp) {
|
|
@@ -9571,6 +9579,8 @@ class MultistreamConnection extends EventEmitter {
|
|
|
9571
9579
|
this.pendingJmpTasks = [];
|
|
9572
9580
|
this.metricsCallback = () => { };
|
|
9573
9581
|
this.overuseUpdateCallback = () => { };
|
|
9582
|
+
this.midMap = new Map();
|
|
9583
|
+
this.currentMid = 0;
|
|
9574
9584
|
this.options = Object.assign(Object.assign({}, defaultMultistreamConnectionOptions), userOptions);
|
|
9575
9585
|
logger.info(`Creating multistream connection with options ${JSON.stringify(this.options)}`);
|
|
9576
9586
|
this.initializePeerConnection();
|
|
@@ -9589,6 +9599,16 @@ class MultistreamConnection extends EventEmitter {
|
|
|
9589
9599
|
this.createSendTransceiver(MediaType.AudioSlides, contentSceneId);
|
|
9590
9600
|
}
|
|
9591
9601
|
}
|
|
9602
|
+
addMid(mediaType) {
|
|
9603
|
+
const mid = this.currentMid++;
|
|
9604
|
+
const mids = this.midMap.get(mediaType) || [];
|
|
9605
|
+
mids.push(`${mid}`);
|
|
9606
|
+
this.midMap.set(mediaType, mids);
|
|
9607
|
+
}
|
|
9608
|
+
clearMids() {
|
|
9609
|
+
this.midMap = new Map();
|
|
9610
|
+
this.currentMid = 0;
|
|
9611
|
+
}
|
|
9592
9612
|
initializePeerConnection() {
|
|
9593
9613
|
var _a;
|
|
9594
9614
|
(_a = this.pc) === null || _a === void 0 ? void 0 : _a.close();
|
|
@@ -9617,6 +9637,7 @@ class MultistreamConnection extends EventEmitter {
|
|
|
9617
9637
|
direction: 'sendrecv',
|
|
9618
9638
|
sendEncodings: sendEncodingsOptions,
|
|
9619
9639
|
});
|
|
9640
|
+
this.addMid(mediaType);
|
|
9620
9641
|
const csi = generateCsi(getMediaFamily(mediaType), sceneId);
|
|
9621
9642
|
this.sendTransceivers.set(mediaType, new SendOnlyTransceiver(rtcTransceiver, csi));
|
|
9622
9643
|
this.createJmpSession(mediaType);
|
|
@@ -9896,6 +9917,7 @@ class MultistreamConnection extends EventEmitter {
|
|
|
9896
9917
|
const rtcRtpTransceiver = this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
|
|
9897
9918
|
direction: 'recvonly',
|
|
9898
9919
|
});
|
|
9920
|
+
this.addMid(mediaType);
|
|
9899
9921
|
const recvOnlyTransceiver = new ReceiveOnlyTransceiver(rtcRtpTransceiver, (mid) => {
|
|
9900
9922
|
const ingressSignaler = this.streamSignalerManager.getIngressStreamSignaler(mid);
|
|
9901
9923
|
if (!ingressSignaler) {
|
|
@@ -9959,6 +9981,9 @@ class MultistreamConnection extends EventEmitter {
|
|
|
9959
9981
|
}
|
|
9960
9982
|
createOffer() {
|
|
9961
9983
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9984
|
+
if (!this.pc.getLocalDescription()) {
|
|
9985
|
+
this.currentMid++;
|
|
9986
|
+
}
|
|
9962
9987
|
return (this.pc
|
|
9963
9988
|
.createOffer()
|
|
9964
9989
|
.then((offer) => {
|
|
@@ -10018,7 +10043,7 @@ class MultistreamConnection extends EventEmitter {
|
|
|
10018
10043
|
}
|
|
10019
10044
|
});
|
|
10020
10045
|
if (getBrowserDetails().name !== 'Firefox') {
|
|
10021
|
-
setupBundle(parsed, this.options.bundlePolicy);
|
|
10046
|
+
setupBundle(parsed, this.options.bundlePolicy, this.midMap);
|
|
10022
10047
|
}
|
|
10023
10048
|
return parsed.toString();
|
|
10024
10049
|
}
|
|
@@ -10053,7 +10078,7 @@ class MultistreamConnection extends EventEmitter {
|
|
|
10053
10078
|
const parsedOffer = parse((_a = this.pc.getLocalDescription()) === null || _a === void 0 ? void 0 : _a.sdp);
|
|
10054
10079
|
matchMlinesInAnswer(parsedOffer, parsedAnswer, this.streamSignalerManager);
|
|
10055
10080
|
if (getBrowserDetails().name === 'Firefox') {
|
|
10056
|
-
setupBundle(parsedAnswer, this.options.bundlePolicy);
|
|
10081
|
+
setupBundle(parsedAnswer, this.options.bundlePolicy, this.midMap);
|
|
10057
10082
|
}
|
|
10058
10083
|
return parsedAnswer.toString();
|
|
10059
10084
|
}
|
|
@@ -10095,11 +10120,13 @@ class MultistreamConnection extends EventEmitter {
|
|
|
10095
10120
|
this.options = Object.assign(Object.assign({}, defaultMultistreamConnectionOptions), userOptions);
|
|
10096
10121
|
}
|
|
10097
10122
|
logger.info(`Renewing multistream connection with options ${JSON.stringify(this.options)}`);
|
|
10123
|
+
this.clearMids();
|
|
10098
10124
|
this.initializePeerConnection();
|
|
10099
10125
|
this.streamSignalerManager = new StreamSignalerManager(this.options.streamSignalingMode);
|
|
10100
10126
|
const mainSceneId = generateSceneId();
|
|
10101
10127
|
this.sendTransceivers.forEach((transceiver, mediaType) => {
|
|
10102
10128
|
var _a;
|
|
10129
|
+
this.addMid(mediaType);
|
|
10103
10130
|
transceiver.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
|
|
10104
10131
|
direction: 'sendrecv',
|
|
10105
10132
|
sendEncodings: getMediaFamily(mediaType) === MediaFamily.Video
|
|
@@ -10115,6 +10142,7 @@ class MultistreamConnection extends EventEmitter {
|
|
|
10115
10142
|
});
|
|
10116
10143
|
this.recvTransceivers.forEach((transceivers, mediaType) => {
|
|
10117
10144
|
transceivers.forEach((t) => {
|
|
10145
|
+
this.addMid(mediaType);
|
|
10118
10146
|
t.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
|
|
10119
10147
|
direction: 'recvonly',
|
|
10120
10148
|
}));
|