handle data race between updateState and OnStateChange (#727)

Signed-off-by: shishir gowda <shishir@livekit.io>
This commit is contained in:
shishirng authored and GitHub committed 2022-05-27 12:54:19 -04:00
1 parent a1c7332943
commit 20681abcdc
1 file changed
+2
+2
View File
@@ -431,6 +431,8 @@ func (p *ParticipantImpl) OnTrackPublished(callback func(types.LocalParticipant,
}
func (p *ParticipantImpl) OnStateChange(callback func(p types.LocalParticipant, oldState livekit.ParticipantInfo_State)) {
p.lock.Lock()
defer p.lock.Unlock()
p.onStateChange = callback
}