Fixed unclean DownTrack close when removed before bound. (#736)
* Fixed unclean DownTrack close when removed before bound. When a DownTrack is closed before it had a chance to be bound to a transceiver, we'd skip close and leave it hanging. This is unlikely in normal operations. However, it can be seen with permissions and subscription APIs. * remove remaining peerID references
This commit is contained in:
@@ -61,23 +61,23 @@ func (d *DownTrackSpreader) Store(ts TrackSender) {
|
||||
d.downTrackMu.Lock()
|
||||
defer d.downTrackMu.Unlock()
|
||||
|
||||
d.downTracks[ts.PeerID()] = ts
|
||||
d.downTracks[ts.SubscriberID()] = ts
|
||||
d.shadowDownTracks()
|
||||
}
|
||||
|
||||
func (d *DownTrackSpreader) Free(peerID livekit.ParticipantID) {
|
||||
func (d *DownTrackSpreader) Free(subscriberID livekit.ParticipantID) {
|
||||
d.downTrackMu.Lock()
|
||||
defer d.downTrackMu.Unlock()
|
||||
|
||||
delete(d.downTracks, peerID)
|
||||
delete(d.downTracks, subscriberID)
|
||||
d.shadowDownTracks()
|
||||
}
|
||||
|
||||
func (d *DownTrackSpreader) HasDownTrack(peerID livekit.ParticipantID) bool {
|
||||
func (d *DownTrackSpreader) HasDownTrack(subscriberID livekit.ParticipantID) bool {
|
||||
d.downTrackMu.RLock()
|
||||
defer d.downTrackMu.RUnlock()
|
||||
|
||||
_, ok := d.downTracks[peerID]
|
||||
_, ok := d.downTracks[subscriberID]
|
||||
return ok
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user