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:
@@ -335,6 +335,21 @@ func (t *MediaTrackSubscriptions) GetAllSubscribers() []livekit.ParticipantID {
|
||||
return subs
|
||||
}
|
||||
|
||||
func (t *MediaTrackSubscriptions) GetAllSubscribersForMime(mime string) []livekit.ParticipantID {
|
||||
t.subscribedTracksMu.RLock()
|
||||
defer t.subscribedTracksMu.RUnlock()
|
||||
|
||||
subs := make([]livekit.ParticipantID, 0, len(t.subscribedTracks))
|
||||
for id, subTrack := range t.subscribedTracks {
|
||||
if subTrack.DownTrack().Codec().MimeType != mime {
|
||||
continue
|
||||
}
|
||||
|
||||
subs = append(subs, id)
|
||||
}
|
||||
return subs
|
||||
}
|
||||
|
||||
func (t *MediaTrackSubscriptions) GetNumSubscribers() int {
|
||||
t.subscribedTracksMu.RLock()
|
||||
defer t.subscribedTracksMu.RUnlock()
|
||||
|
||||
Reference in New Issue
Block a user