Prevent track subscriptions/adding receivers after close (#924)
* Prevent track subscriptions/adding receivers after close With subscribe/unsubscribe queuing, a subscribe may be attempted after a call to `RemoveAllSubscribers`. So, renaming `RemoveAllSubscribers` to `InitiateClose` and maintaining state that track is in the process of closing. * Mime specific remove * Remove unused error * do not add receiver when closing
This commit is contained in:
@@ -68,7 +68,7 @@ func (u *UpTrackManager) Close(willBeResumed bool) {
|
||||
|
||||
// remove all subscribers
|
||||
for _, t := range u.GetPublishedTracks() {
|
||||
t.RemoveAllSubscribers(willBeResumed)
|
||||
t.InitiateClose(willBeResumed)
|
||||
}
|
||||
|
||||
if notify && u.onClose != nil {
|
||||
@@ -317,7 +317,7 @@ func (u *UpTrackManager) AddPublishedTrack(track types.MediaTrack) {
|
||||
}
|
||||
|
||||
func (u *UpTrackManager) RemovePublishedTrack(track types.MediaTrack, willBeResumed bool) {
|
||||
track.RemoveAllSubscribers(willBeResumed)
|
||||
track.InitiateClose(willBeResumed)
|
||||
u.lock.Lock()
|
||||
delete(u.publishedTracks, track.ID())
|
||||
u.lock.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user