add idempotent reference count to telemetry stats worker (#3964)

* add idempotent reference guard to telemetry stats worker

* tidy

* sync

* tidy
This commit is contained in:
Paul Wells
2025-09-29 02:35:16 -07:00
committed by GitHub
parent 735c663adc
commit 3d73703152
12 changed files with 198 additions and 55 deletions
+8
View File
@@ -283,6 +283,9 @@ type ParticipantImpl struct {
rttUpdatedAt time.Time
lastRTT uint32
// idempotent reference guard for telemetry stats worker
telemetryGuard *telemetry.ReferenceGuard
lock utils.RWMutex
dirty atomic.Bool
@@ -369,6 +372,7 @@ func NewParticipant(params ParticipantParams) (*ParticipantImpl, error) {
rpcPendingAcks: make(map[string]*utils.DataChannelRpcPendingAckHandler),
rpcPendingResponses: make(map[string]*utils.DataChannelRpcPendingResponseHandler),
onClose: make(map[string]func(types.LocalParticipant)),
telemetryGuard: &telemetry.ReferenceGuard{},
}
p.setupSignalling()
@@ -884,6 +888,10 @@ func (p *ParticipantImpl) ToProto() *livekit.ParticipantInfo {
return pi
}
func (p *ParticipantImpl) TelemetryGuard() *telemetry.ReferenceGuard {
return p.telemetryGuard
}
// callbacks for clients
func (p *ParticipantImpl) OnTrackPublished(callback func(types.LocalParticipant, types.MediaTrack)) {