Misc clean up (#1099)
This commit is contained in:
@@ -399,29 +399,23 @@ func (t *MediaTrackSubscriptions) downTrackClosed(
|
|||||||
if !willBeResumed {
|
if !willBeResumed {
|
||||||
t.params.Telemetry.TrackUnsubscribed(context.Background(), subscriberID, t.params.MediaTrack.ToProto())
|
t.params.Telemetry.TrackUnsubscribed(context.Background(), subscriberID, t.params.MediaTrack.ToProto())
|
||||||
|
|
||||||
// if the source has been terminated, we'll need to terminate all the subscribed tracks
|
if sender != nil {
|
||||||
// however, if the dest sub has disconnected, then we can skip
|
sub.GetLogger().Debugw("removing PeerConnection track",
|
||||||
if sender == nil {
|
"publisher", subTrack.PublisherIdentity(),
|
||||||
return
|
"publisherID", subTrack.PublisherID(),
|
||||||
}
|
"kind", t.params.MediaTrack.Kind(),
|
||||||
sub.GetLogger().Debugw("removing PeerConnection track",
|
)
|
||||||
"publisher", subTrack.PublisherIdentity(),
|
|
||||||
"publisherID", subTrack.PublisherID(),
|
if err := sub.RemoveTrackFromSubscriber(sender); err != nil {
|
||||||
"kind", t.params.MediaTrack.Kind(),
|
if _, ok := err.(*rtcerr.InvalidStateError); !ok {
|
||||||
)
|
// most of these are safe to ignore, since the track state might have already
|
||||||
if err := sub.RemoveTrackFromSubscriber(sender); err != nil {
|
// been set to Inactive
|
||||||
if err == webrtc.ErrConnectionClosed {
|
sub.GetLogger().Debugw("could not remove remoteTrack from forwarder",
|
||||||
// sub closing, can skip removing subscribedtracks
|
"error", err,
|
||||||
return
|
"publisher", subTrack.PublisherIdentity(),
|
||||||
}
|
"publisherID", subTrack.PublisherID(),
|
||||||
if _, ok := err.(*rtcerr.InvalidStateError); !ok {
|
)
|
||||||
// most of these are safe to ignore, since the track state might have already
|
}
|
||||||
// been set to Inactive
|
|
||||||
sub.GetLogger().Debugw("could not remove remoteTrack from forwarder",
|
|
||||||
"error", err,
|
|
||||||
"publisher", subTrack.PublisherIdentity(),
|
|
||||||
"publisherID", subTrack.PublisherID(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -894,6 +894,10 @@ func (t *PCTransport) getOnNegotiationFailed() func() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *PCTransport) Negotiate(force bool) {
|
func (t *PCTransport) Negotiate(force bool) {
|
||||||
|
if t.isClosed.Load() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if force {
|
if force {
|
||||||
t.lock.Lock()
|
t.lock.Lock()
|
||||||
t.debouncedNegotiate(func() {
|
t.debouncedNegotiate(func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user