make per-user audio state thread-safe
Move volume, boost, mute, and OpenAL source behind accessors guarded by a per-user mutex. The audio goroutine reads these fields on every decoded packet while the UI writes them from key handlers, which is a data race on the gain a stream is currently rendering with. Also add the per-user sequence fields the decoder needs to notice gaps in a user's audio stream. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
b67940ddbc
commit
60470ad091
@@ -179,11 +179,11 @@ func (b *Barnard) OnUserChange(e *gumble.UserChangeEvent) {
|
||||
// If the channel is muted, ensure the user is muted
|
||||
if b.MutedChannels[e.User.Channel.ID] {
|
||||
// Only mute if not already muted
|
||||
if !e.User.LocallyMuted {
|
||||
if !e.User.LocallyMuted() {
|
||||
b.UserConfig.ToggleMute(e.User)
|
||||
}
|
||||
if e.User.AudioSource != nil {
|
||||
e.User.AudioSource.SetGain(0)
|
||||
if source := e.User.AudioSource(); source != nil {
|
||||
source.SetGain(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user