Skip to content

Commit

Permalink
Only wait for publications that are pending already
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasIO committed Dec 3, 2024
1 parent ae729b3 commit 89c8bc0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/room/participant/LocalParticipant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,10 @@ export default class LocalParticipant extends Participant {
if (this.pendingPublishing.has(source)) {
const pendingTrack = await this.waitForPendingPublicationOfSource(source);
if (!pendingTrack) {
this.log.info('skipping duplicate published source', { ...this.logContext, source });
this.log.info('waiting for pending publication promise timed out', {
...this.logContext,
source,
});
}
await pendingTrack?.unmute();
return pendingTrack;
Expand Down Expand Up @@ -508,9 +511,15 @@ export default class LocalParticipant extends Participant {
}
}
} else {
if (!track?.track) {
if (!track?.track && this.pendingPublishing.has(source)) {
// if there's no track available yet first wait for pending publishing promises of that source to see if it becomes available
track = await this.waitForPendingPublicationOfSource(source);
if (!track) {
this.log.info('waiting for pending publication promise timed out', {
...this.logContext,
source,
});
}
}
if (track && track.track) {
// screenshare cannot be muted, unpublish instead
Expand Down Expand Up @@ -2029,6 +2038,5 @@ export default class LocalParticipant extends Participant {
}
await sleep(20);
}
throw new Error('waiting for pending publication promise timed out');
}
}

0 comments on commit 89c8bc0

Please sign in to comment.