Fix incorrect accounting for track published/subscribed stats. (#1336)
It was not getting decremented in certain cases.
This commit is contained in:
+7
-10
@@ -1611,16 +1611,13 @@ func (p *ParticipantImpl) addMediaTrack(signalCid string, sdpCid string, ti *liv
|
|||||||
p.supervisor.ClearPublishedTrack(livekit.TrackID(ti.Sid), mt)
|
p.supervisor.ClearPublishedTrack(livekit.TrackID(ti.Sid), mt)
|
||||||
|
|
||||||
// not logged when closing
|
// not logged when closing
|
||||||
if !p.isClosed.Load() {
|
p.params.Telemetry.TrackUnpublished(
|
||||||
p.params.Telemetry.TrackUnpublished(
|
context.Background(),
|
||||||
context.Background(),
|
p.ID(),
|
||||||
p.ID(),
|
p.Identity(),
|
||||||
p.Identity(),
|
mt.ToProto(),
|
||||||
mt.ToProto(),
|
!p.IsClosed(),
|
||||||
true,
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
p.MigrateState()
|
|
||||||
|
|
||||||
// re-use track sid
|
// re-use track sid
|
||||||
p.pendingTracksLock.Lock()
|
p.pendingTracksLock.Lock()
|
||||||
|
|||||||
@@ -512,14 +512,16 @@ func (m *SubscriptionManager) handleSubscribedTrackClose(s *trackSubscription, w
|
|||||||
s.setSubscribedTrack(nil)
|
s.setSubscribedTrack(nil)
|
||||||
go m.params.OnTrackUnsubscribed(subTrack)
|
go m.params.OnTrackUnsubscribed(subTrack)
|
||||||
|
|
||||||
|
// always trigger to decrement unsubscribed counter. However, only log an analytics event when
|
||||||
|
// * the participant isn't closing
|
||||||
|
// * it's not a migration
|
||||||
|
m.params.Telemetry.TrackUnsubscribed(
|
||||||
|
context.Background(),
|
||||||
|
m.params.Participant.ID(),
|
||||||
|
&livekit.TrackInfo{Sid: string(s.trackID), Type: subTrack.MediaTrack().Kind()},
|
||||||
|
!willBeResumed && !m.params.Participant.IsClosed(),
|
||||||
|
)
|
||||||
if !willBeResumed {
|
if !willBeResumed {
|
||||||
m.params.Telemetry.TrackUnsubscribed(
|
|
||||||
context.Background(),
|
|
||||||
m.params.Participant.ID(),
|
|
||||||
&livekit.TrackInfo{Sid: string(s.trackID), Type: subTrack.MediaTrack().Kind()},
|
|
||||||
!m.params.Participant.IsClosed(),
|
|
||||||
)
|
|
||||||
|
|
||||||
sender := subTrack.RTPSender()
|
sender := subTrack.RTPSender()
|
||||||
if sender != nil {
|
if sender != nil {
|
||||||
m.params.Logger.Debugw("removing PeerConnection track",
|
m.params.Logger.Debugw("removing PeerConnection track",
|
||||||
|
|||||||
Reference in New Issue
Block a user