Do not unsubscribe from track if it's been republished (#1424)

thank you @boks1971 for the debugging
This commit is contained in:
David Zhao
2023-02-14 23:12:08 -08:00
committed by GitHub
parent 610c37f51a
commit 4f6fda586c
+6
View File
@@ -399,6 +399,12 @@ func (m *SubscriptionManager) subscribe(s *trackSubscription) error {
}
if res.TrackRemovedNotifier != nil && s.setRemovedNotifier(res.TrackRemovedNotifier) {
res.TrackRemovedNotifier.AddObserver(string(m.params.Participant.ID()), func() {
// re-resolve the track in case the same track had been re-published
res := m.params.TrackResolver(m.params.Participant.Identity(), s.trackID)
if res.Track != nil {
// do not unsubscribe, track is still available
return
}
// source track removed, we would unsubscribe
s.logger.Debugw("unsubscribing track since source track was removed")
s.setDesired(false)