From 2a35f4e5d9b43f97cf3f134154638ea586fff548 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Fri, 22 May 2020 16:55:56 +0200 Subject: [PATCH] Don't add duplicates in addLocal. --- group.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/group.go b/group.go index 1827944..71ec353 100644 --- a/group.go +++ b/group.go @@ -52,6 +52,12 @@ func (up *upTrack) notifyLocal() { func (up *upTrack) addLocal(local *downTrack) { up.mu.Lock() + for _, t := range up.local { + if t == local { + up.mu.Unlock() + return + } + } up.local = append(up.local, local) up.mu.Unlock() up.notifyLocal()