Avoid locking when flushing DownTrack (#594)
This commit is contained in:
@@ -49,15 +49,14 @@ func (u *UpTrackManager) Start() {
|
||||
func (u *UpTrackManager) Close() {
|
||||
u.lock.Lock()
|
||||
u.closed = true
|
||||
|
||||
// remove all subscribers
|
||||
for _, t := range u.publishedTracks {
|
||||
t.RemoveAllSubscribers()
|
||||
}
|
||||
|
||||
notify := len(u.publishedTracks) == 0
|
||||
u.lock.Unlock()
|
||||
|
||||
// remove all subscribers
|
||||
for _, t := range u.GetPublishedTracks() {
|
||||
t.RemoveAllSubscribers()
|
||||
}
|
||||
|
||||
if notify && u.onClose != nil {
|
||||
u.onClose()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user