From ffb3dfc4a1a906a0b47a57dd2b36c8f4836d379c Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 18 Aug 2023 22:27:58 -0700 Subject: [PATCH] Clean up from tracks when unpublished Fixes #294 --- remoteparticipant.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/remoteparticipant.go b/remoteparticipant.go index e5e25930..d05af9f6 100644 --- a/remoteparticipant.go +++ b/remoteparticipant.go @@ -134,14 +134,13 @@ func (p *RemoteParticipant) unpublishTrack(sid string, sendUnpublish bool) { return } - p.lock.Lock() switch pub.Kind() { case TrackKindAudio: p.audioTracks.Delete(sid) case TrackKindVideo: p.videoTracks.Delete(sid) } - p.lock.Unlock() + p.tracks.Delete(sid) track := pub.TrackRemote() if track != nil {