Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit d1492b8

Browse files
starwarfanjianjunz
andauthored
Avoid creating offer before last negotiation ended (#436)
Co-authored-by: jianjunz <[email protected]>
1 parent df65d0f commit d1492b8

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/sdk/conference/channel.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ export class ConferencePeerConnectionChannel extends EventDispatcher {
204204
mediaOptions.video = false;
205205
}
206206

207+
const internalId = this._createInternalId();
208+
// Waiting for previous SDP negotiation if needed
209+
await this._chainSdpPromise(internalId);
210+
207211
const offerOptions = {};
208212
const transceivers = [];
209213
if (typeof this._pc.addTransceiver === 'function') {
@@ -278,11 +282,7 @@ export class ConferencePeerConnectionChannel extends EventDispatcher {
278282
offerOptions.offerToReceiveAudio = false;
279283
offerOptions.offerToReceiveVideo = false;
280284
}
281-
282-
const internalId = this._createInternalId();
283285
this._publishTransceivers.set(internalId, {transceivers});
284-
// Waiting for previous SDP negotiation if needed
285-
await this._chainSdpPromise(internalId);
286286

287287
let localDesc;
288288
this._pc.createOffer(offerOptions).then((desc) => {
@@ -441,6 +441,10 @@ export class ConferencePeerConnectionChannel extends EventDispatcher {
441441
mediaOptions.video = false;
442442
}
443443

444+
const internalId = this._createInternalId();
445+
// Waiting for previous SDP negotiation if needed
446+
await this._chainSdpPromise(internalId);
447+
444448
const offerOptions = {};
445449
const transceivers = [];
446450
this._createPeerConnection();
@@ -471,14 +475,9 @@ export class ConferencePeerConnectionChannel extends EventDispatcher {
471475
offerOptions.offerToReceiveAudio = !!options.audio;
472476
offerOptions.offerToReceiveVideo = !!options.video;
473477
}
474-
475-
const internalId = this._createInternalId();
476478
this._subscribeTransceivers.set(internalId, {transceivers});
477479
this._subscribedStreams.set(internalId, stream);
478480

479-
// Waiting for previous SDP negotiation if needed
480-
await this._chainSdpPromise(internalId);
481-
482481
let localDesc;
483482
this._pc.createOffer(offerOptions).then((desc) => {
484483
localDesc = desc;

0 commit comments

Comments
 (0)