Adding some logs in subscribe path. (#2343)
Trying to chase down an older client failing to subscribe some times.
This commit is contained in:
@@ -207,6 +207,12 @@ func (t *MediaTrackSubscriptions) AddSubscriber(sub types.LocalParticipant, wr *
|
|||||||
replacedTrack := false
|
replacedTrack := false
|
||||||
existingTransceiver, dtState = sub.GetCachedDownTrack(trackID)
|
existingTransceiver, dtState = sub.GetCachedDownTrack(trackID)
|
||||||
if existingTransceiver != nil {
|
if existingTransceiver != nil {
|
||||||
|
sub.GetLogger().Debugw(
|
||||||
|
"trying to use existing transceiver",
|
||||||
|
"publisher", subTrack.PublisherIdentity(),
|
||||||
|
"publisherID", subTrack.PublisherID(),
|
||||||
|
"trackID", trackID,
|
||||||
|
)
|
||||||
reusingTransceiver.Store(true)
|
reusingTransceiver.Store(true)
|
||||||
rtpSender := existingTransceiver.Sender()
|
rtpSender := existingTransceiver.Sender()
|
||||||
if rtpSender != nil {
|
if rtpSender != nil {
|
||||||
@@ -217,6 +223,12 @@ func (t *MediaTrackSubscriptions) AddSubscriber(sub types.LocalParticipant, wr *
|
|||||||
sender = rtpSender
|
sender = rtpSender
|
||||||
transceiver = existingTransceiver
|
transceiver = existingTransceiver
|
||||||
replacedTrack = true
|
replacedTrack = true
|
||||||
|
sub.GetLogger().Debugw(
|
||||||
|
"track replaced",
|
||||||
|
"publisher", subTrack.PublisherIdentity(),
|
||||||
|
"publisherID", subTrack.PublisherID(),
|
||||||
|
"trackID", trackID,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -505,8 +505,17 @@ func (m *SubscriptionManager) subscribe(s *trackSubscription) error {
|
|||||||
subTrack, err := track.AddSubscriber(m.params.Participant)
|
subTrack, err := track.AddSubscriber(m.params.Participant)
|
||||||
if err != nil && err != errAlreadySubscribed {
|
if err != nil && err != errAlreadySubscribed {
|
||||||
// ignore already subscribed error
|
// ignore already subscribed error
|
||||||
|
m.params.Logger.Warnw("add subscriber failed", err, "trackID", trackID)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err == errAlreadySubscribed {
|
||||||
|
m.params.Logger.Debugw(
|
||||||
|
"already subscribed to track",
|
||||||
|
"trackID", trackID,
|
||||||
|
"subscribedAudioCount", m.subscribedAudioCount.Load(),
|
||||||
|
"subscribedVideoCount", m.subscribedVideoCount.Load(),
|
||||||
|
)
|
||||||
|
}
|
||||||
if err == nil && subTrack != nil { // subTrack could be nil if already subscribed
|
if err == nil && subTrack != nil { // subTrack could be nil if already subscribed
|
||||||
subTrack.OnClose(func(willBeResumed bool) {
|
subTrack.OnClose(func(willBeResumed bool) {
|
||||||
m.handleSubscribedTrackClose(s, willBeResumed)
|
m.handleSubscribedTrackClose(s, willBeResumed)
|
||||||
@@ -536,9 +545,14 @@ func (m *SubscriptionManager) subscribe(s *trackSubscription) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
go m.params.OnTrackSubscribed(subTrack)
|
go m.params.OnTrackSubscribed(subTrack)
|
||||||
}
|
|
||||||
|
|
||||||
m.params.Logger.Debugw("subscribed to track", "trackID", trackID, "subscribedAudioCount", m.subscribedAudioCount.Load(), "subscribedVideoCount", m.subscribedVideoCount.Load())
|
m.params.Logger.Debugw(
|
||||||
|
"subscribed to track",
|
||||||
|
"trackID", trackID,
|
||||||
|
"subscribedAudioCount", m.subscribedAudioCount.Load(),
|
||||||
|
"subscribedVideoCount", m.subscribedVideoCount.Load(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// add mark the participant as someone we've subscribed to
|
// add mark the participant as someone we've subscribed to
|
||||||
firstSubscribe := false
|
firstSubscribe := false
|
||||||
@@ -596,7 +610,8 @@ func (m *SubscriptionManager) handleSourceTrackRemoved(trackID livekit.TrackID)
|
|||||||
// - UpTrack was closed
|
// - UpTrack was closed
|
||||||
// - publisher revoked permissions for the participant
|
// - publisher revoked permissions for the participant
|
||||||
func (m *SubscriptionManager) handleSubscribedTrackClose(s *trackSubscription, willBeResumed bool) {
|
func (m *SubscriptionManager) handleSubscribedTrackClose(s *trackSubscription, willBeResumed bool) {
|
||||||
s.logger.Debugw("subscribed track closed",
|
s.logger.Debugw(
|
||||||
|
"subscribed track closed",
|
||||||
"willBeResumed", willBeResumed,
|
"willBeResumed", willBeResumed,
|
||||||
)
|
)
|
||||||
wasBound := s.isBound()
|
wasBound := s.isBound()
|
||||||
|
|||||||
@@ -351,6 +351,7 @@ func NewDownTrack(params DowntrackParams) (*DownTrack, error) {
|
|||||||
go d.maxLayerNotifierWorker()
|
go d.maxLayerNotifierWorker()
|
||||||
go d.keyFrameRequester()
|
go d.keyFrameRequester()
|
||||||
}
|
}
|
||||||
|
d.params.Logger.Debugw("downtrack created")
|
||||||
|
|
||||||
return d, nil
|
return d, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user