Use active at time to check for track not bound timeout. (#4206)

This commit is contained in:
Raja Subramanian
2025-12-29 20:32:08 +05:30
committed by GitHub
parent 3606ce542f
commit 08793bea89
4 changed files with 79 additions and 4 deletions
+7 -4
View File
@@ -548,10 +548,13 @@ func (m *SubscriptionManager) reconcileSubscription(s *mediaTrackSubscription) {
// check bound status, notify error callback if it's not bound
// if a publisher leaves or closes the source track, SubscribedTrack will be closed as well and it will go
// back to needsSubscribe state
if m.params.Participant.IsReady() && s.durationSinceStart() > subscriptionTimeout {
s.logger.Warnw("track not bound after timeout", nil)
s.maybeRecordError(m.params.Telemetry, s.subscriberID, ErrTrackNotBound, false)
m.params.OnSubscriptionError(s.trackID, true, ErrTrackNotBound)
if activeAt := m.params.Participant.ActiveAt(); !activeAt.IsZero() {
wait := min(time.Since(activeAt), s.durationSinceStart())
if wait > subscriptionTimeout {
s.logger.Warnw("track not bound after timeout", nil)
s.maybeRecordError(m.params.Telemetry, s.subscriberID, ErrTrackNotBound, false)
m.params.OnSubscriptionError(s.trackID, true, ErrTrackNotBound)
}
}
}