Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/webrtc/groupCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ export class GroupCallError extends Error {
}
}

export class OtherUserSpeakingError extends Error {
constructor() {
super("Cannot unmute: another user is speaking");
}
}

export interface IGroupCallDataChannelOptions {
ordered: boolean;
maxPacketLifeTime: number;
Expand Down Expand Up @@ -408,6 +414,12 @@ export class GroupCall extends EventEmitter {

// set a timer for the maximum transmit time on PTT calls
if (this.isPtt) {
// if anoher user is currently unmuted, we can't unmute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a bit weird to force on everyone.

If I was using this for game callouts, I would want to interrupt the other person.

if (!muted && this.userMediaFeeds.some(f => !f.isAudioMuted())) {
throw new OtherUserSpeakingError();
}
Copy link
Contributor

@MadLittleMods MadLittleMods Apr 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems susceptible to ping response time races? If multiple people unmute at the same time, they all would be allowed.


// Set or clear the max transmit timer
if (!muted && this.isMicrophoneMuted()) {
this.transmitTimer = setTimeout(() => {
this.setMicrophoneMuted(true);
Expand Down