Skip to content

Commit

Permalink
revert immediately start first negotiation (#1231)
Browse files Browse the repository at this point in the history
* revert immediately start first negotiation

* prettier
  • Loading branch information
cnderrauber authored Aug 28, 2024
1 parent 10b3b68 commit accb751
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions src/room/PCTransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,22 +219,18 @@ export default class PCTransport extends EventEmitter {
}

// debounced negotiate interface
negotiate = debounce(
async (onError?: (e: Error) => void) => {
this.emit(PCEvents.NegotiationStarted);
try {
await this.createAndSendOffer();
} catch (e) {
if (onError) {
onError(e as Error);
} else {
throw e;
}
negotiate = debounce(async (onError?: (e: Error) => void) => {
this.emit(PCEvents.NegotiationStarted);
try {
await this.createAndSendOffer();
} catch (e) {
if (onError) {
onError(e as Error);
} else {
throw e;
}
},
debounceInterval,
{ isImmediate: true },
);
}
}, debounceInterval);

async createAndSendOffer(options?: RTCOfferOptions) {
if (this.onOffer === undefined) {
Expand Down

0 comments on commit accb751

Please sign in to comment.