Fix dynacast quality for moving out tracks (#3664)

* Make sure moving out track has been unsubscribed

Remove start time checking in subscription manager
as We always use new track ID for republished track at #3020
so there is no race condition now.

Also RemoveSubscriber for moving out tracks for safety,
the subscription manager will handle the removed event but
RemoveSubscriber again will not be bad.

* Clear subscriber node max quality for moving out tracks
This commit is contained in:
cnderrauber
2025-05-14 12:54:33 +08:00
committed by GitHub
parent 0a5f3c2ae6
commit dbb70e0f06
7 changed files with 59 additions and 9 deletions
-9
View File
@@ -1110,15 +1110,6 @@ func (s *trackSubscription) getNumAttempts() int32 {
func (s *trackSubscription) handleSourceTrackRemoved() {
s.lock.Lock()
defer s.lock.Unlock()
startedAt := s.subStartedAt.Load()
if startedAt == nil || time.Since(*startedAt) < trackRemoveGracePeriod {
// to prevent race conditions, if we've recently been asked to subscribe to a track
// ignore when source was removed. reconciler will take care of it eventually
// this would address the case when a track was unpublished and republished immediately
// it's possible for another caller to call setDesired(true) for the republished track before
// handleSourceTrackRemoved is called on the previously unpublished track
return
}
// source track removed, we would unsubscribe
s.logger.Debugw("unsubscribing from track since source track was removed")