mirror of
https://github.com/livekit/livekit.git
synced 2026-11-12 20:49:07 +00:00
applySettings releases settingsLock before it computes the video layers, then reads t.settings.Quality, Width, Height and Fps without the lock. UpdateSubscriberSettings replaces t.settings under the lock, and the debouncer and UpdateVideoLayer run applySettings on other goroutines, so the reads race with the write. go test -race reports it on the pointer and on the fields of the newly cloned settings. Take the settings pointer while holding the lock and compute the layers from that snapshot. UpdateSubscriberSettings always stores a fresh clone and never mutates it, so the snapshot is safe to read after unlocking, and all four values come from the same update.