@webex/web-client-media-engine 3.7.2 → 3.8.0
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 +22 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +22 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -14153,6 +14153,7 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
14153
14153
|
this.overuseUpdateCallback = () => { };
|
|
14154
14154
|
this.midPredictor = new MidPredictor();
|
|
14155
14155
|
this.offerAnswerQueue = new AsyncQueue();
|
|
14156
|
+
this.currentCreateOfferId = 0;
|
|
14156
14157
|
this.options = Object.assign(Object.assign({}, defaultMultistreamConnectionOptions), userOptions);
|
|
14157
14158
|
logger.info(`Creating multistream connection with options ${JSON.stringify(this.options)}`);
|
|
14158
14159
|
this.initializePeerConnection();
|
|
@@ -14516,16 +14517,16 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
14516
14517
|
if (!this.pc.getLocalDescription()) {
|
|
14517
14518
|
this.midPredictor.allocateMidForDatachannel();
|
|
14518
14519
|
}
|
|
14520
|
+
if (this.setAnswerResolve) {
|
|
14521
|
+
logger.info('Canceling previous offer since setAnswer was never called for it');
|
|
14522
|
+
this.setAnswerResolve();
|
|
14523
|
+
this.setAnswerResolve = undefined;
|
|
14524
|
+
}
|
|
14525
|
+
const createOfferId = ++this.currentCreateOfferId;
|
|
14519
14526
|
return new Promise((createOfferResolve, createOfferReject) => {
|
|
14520
14527
|
this.offerAnswerQueue.push(() => __awaiter(this, void 0, void 0, function* () {
|
|
14521
14528
|
var _a;
|
|
14522
14529
|
try {
|
|
14523
|
-
if (this.setAnswerResolve !== undefined) {
|
|
14524
|
-
throw new Error(`Tried to start a new createOffer flow before the old one had finished`);
|
|
14525
|
-
}
|
|
14526
|
-
const setAnswerPromise = new Promise((resolve) => {
|
|
14527
|
-
this.setAnswerResolve = resolve;
|
|
14528
|
-
});
|
|
14529
14530
|
const offer = yield this.pc.createOffer();
|
|
14530
14531
|
if (!offer.sdp) {
|
|
14531
14532
|
throw new Error('No SDP offer');
|
|
@@ -14534,11 +14535,17 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
14534
14535
|
yield this.pc.setLocalDescription(offer);
|
|
14535
14536
|
const sdpToSend = this.prepareLocalOfferForRemoteServer((_a = this.pc.getLocalDescription()) === null || _a === void 0 ? void 0 : _a.sdp);
|
|
14536
14537
|
createOfferResolve({ type: 'offer', sdp: sdpToSend });
|
|
14537
|
-
|
|
14538
|
+
if (this.currentCreateOfferId > createOfferId) {
|
|
14539
|
+
logger.log('Canceling previous offer since createOffer was called while it was being created');
|
|
14540
|
+
}
|
|
14541
|
+
else {
|
|
14542
|
+
yield new Promise((setAnswerResolve) => {
|
|
14543
|
+
this.setAnswerResolve = setAnswerResolve;
|
|
14544
|
+
});
|
|
14545
|
+
}
|
|
14538
14546
|
}
|
|
14539
14547
|
catch (error) {
|
|
14540
14548
|
createOfferReject(error);
|
|
14541
|
-
this.setAnswerResolve = undefined;
|
|
14542
14549
|
}
|
|
14543
14550
|
}));
|
|
14544
14551
|
});
|
|
@@ -14774,13 +14781,18 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
14774
14781
|
const statsToModify = stats.get(senderStats.id);
|
|
14775
14782
|
statsToModify.mid = transceiver.mid;
|
|
14776
14783
|
statsToModify.csi = transceiver.csi;
|
|
14777
|
-
statsToModify.
|
|
14784
|
+
statsToModify.calliopeMediaType = mediaType;
|
|
14778
14785
|
const trackSettings = (_a = transceiver.publishedStream) === null || _a === void 0 ? void 0 : _a.getSettings();
|
|
14779
14786
|
if (trackSettings === null || trackSettings === void 0 ? void 0 : trackSettings.frameRate) {
|
|
14780
14787
|
statsToModify.targetFrameRate = trackSettings === null || trackSettings === void 0 ? void 0 : trackSettings.frameRate;
|
|
14781
14788
|
}
|
|
14782
14789
|
stats.set(senderStats.id, statsToModify);
|
|
14783
14790
|
}
|
|
14791
|
+
else if (senderStats.type === 'media-source') {
|
|
14792
|
+
const statsToModify = stats.get(senderStats.id);
|
|
14793
|
+
statsToModify.calliopeMediaType = mediaType;
|
|
14794
|
+
stats.set(senderStats.id, statsToModify);
|
|
14795
|
+
}
|
|
14784
14796
|
});
|
|
14785
14797
|
})));
|
|
14786
14798
|
yield Promise.all([...this.recvTransceivers.entries()].map(([mediaType, transceivers]) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -14791,7 +14803,7 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
14791
14803
|
const statsToModify = stats.get(receiverStats.id);
|
|
14792
14804
|
statsToModify.mid = (_a = transceiver.receiveSlot.id) === null || _a === void 0 ? void 0 : _a.mid;
|
|
14793
14805
|
statsToModify.csi = transceiver.receiveSlot.currentRxCsi;
|
|
14794
|
-
statsToModify.
|
|
14806
|
+
statsToModify.calliopeMediaType = mediaType;
|
|
14795
14807
|
Object.assign(statsToModify, transceiver.receiverId);
|
|
14796
14808
|
stats.set(receiverStats.id, statsToModify);
|
|
14797
14809
|
}
|