Fix some races reported by go -race (#706)

* Fix some races reported by go -race

* Avoid copy
This commit is contained in:
Raja Subramanian
2022-05-23 11:51:13 +05:30
committed by GitHub
parent cc5b12709e
commit 96b095504b
5 changed files with 53 additions and 29 deletions
+4 -3
View File
@@ -865,9 +865,10 @@ func (r *Room) audioUpdateWorker() {
// changedSpeakers need to include previous speakers that are no longer speaking
for sid, speaker := range lastActiveMap {
if nextActiveMap[sid] == nil {
speaker.Level = 0
speaker.Active = false
changedSpeakers = append(changedSpeakers, speaker)
inactiveSpeaker := proto.Clone(speaker).(*livekit.SpeakerInfo)
inactiveSpeaker.Level = 0
inactiveSpeaker.Active = false
changedSpeakers = append(changedSpeakers, inactiveSpeaker)
}
}