@webex/web-client-media-engine 3.7.2 → 3.7.3
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 +15 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +15 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -14149,6 +14149,7 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
14149
14149
|
this.overuseUpdateCallback = () => { };
|
|
14150
14150
|
this.midPredictor = new MidPredictor();
|
|
14151
14151
|
this.offerAnswerQueue = new AsyncQueue();
|
|
14152
|
+
this.currentCreateOfferId = 0;
|
|
14152
14153
|
this.options = Object.assign(Object.assign({}, defaultMultistreamConnectionOptions), userOptions);
|
|
14153
14154
|
logger.info(`Creating multistream connection with options ${JSON.stringify(this.options)}`);
|
|
14154
14155
|
this.initializePeerConnection();
|
|
@@ -14512,16 +14513,16 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
14512
14513
|
if (!this.pc.getLocalDescription()) {
|
|
14513
14514
|
this.midPredictor.allocateMidForDatachannel();
|
|
14514
14515
|
}
|
|
14516
|
+
if (this.setAnswerResolve) {
|
|
14517
|
+
logger.info('Canceling previous offer since setAnswer was never called for it');
|
|
14518
|
+
this.setAnswerResolve();
|
|
14519
|
+
this.setAnswerResolve = undefined;
|
|
14520
|
+
}
|
|
14521
|
+
const createOfferId = ++this.currentCreateOfferId;
|
|
14515
14522
|
return new Promise((createOfferResolve, createOfferReject) => {
|
|
14516
14523
|
this.offerAnswerQueue.push(() => __awaiter(this, void 0, void 0, function* () {
|
|
14517
14524
|
var _a;
|
|
14518
14525
|
try {
|
|
14519
|
-
if (this.setAnswerResolve !== undefined) {
|
|
14520
|
-
throw new Error(`Tried to start a new createOffer flow before the old one had finished`);
|
|
14521
|
-
}
|
|
14522
|
-
const setAnswerPromise = new Promise((resolve) => {
|
|
14523
|
-
this.setAnswerResolve = resolve;
|
|
14524
|
-
});
|
|
14525
14526
|
const offer = yield this.pc.createOffer();
|
|
14526
14527
|
if (!offer.sdp) {
|
|
14527
14528
|
throw new Error('No SDP offer');
|
|
@@ -14530,11 +14531,17 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
14530
14531
|
yield this.pc.setLocalDescription(offer);
|
|
14531
14532
|
const sdpToSend = this.prepareLocalOfferForRemoteServer((_a = this.pc.getLocalDescription()) === null || _a === void 0 ? void 0 : _a.sdp);
|
|
14532
14533
|
createOfferResolve({ type: 'offer', sdp: sdpToSend });
|
|
14533
|
-
|
|
14534
|
+
if (this.currentCreateOfferId > createOfferId) {
|
|
14535
|
+
logger.log('Canceling previous offer since createOffer was called while it was being created');
|
|
14536
|
+
}
|
|
14537
|
+
else {
|
|
14538
|
+
yield new Promise((setAnswerResolve) => {
|
|
14539
|
+
this.setAnswerResolve = setAnswerResolve;
|
|
14540
|
+
});
|
|
14541
|
+
}
|
|
14534
14542
|
}
|
|
14535
14543
|
catch (error) {
|
|
14536
14544
|
createOfferReject(error);
|
|
14537
|
-
this.setAnswerResolve = undefined;
|
|
14538
14545
|
}
|
|
14539
14546
|
}));
|
|
14540
14547
|
});
|