Key telemetry stats worker using combination of roomID, participantID (#4323)
* Key telemetry stats work using combination of roomID, participantID With forwarded participant, the same participantID can existing in two rooms. NOTE: This does not yet allow a participant session to report its events/track stats into multiple rooms. That would require regitering multiple listeners (from rooms a participant is forwarded to). * missed file * data channel stats * PR comments + pass in room name so that telemetry events have proper room name also
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
package rtc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"math"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -86,7 +85,7 @@ type MediaTrackParams struct {
|
||||
PLIThrottleConfig sfu.PLIThrottleConfig
|
||||
AudioConfig sfu.AudioConfig
|
||||
VideoConfig config.VideoConfig
|
||||
Telemetry telemetry.TelemetryService
|
||||
TelemetryListener types.ParticipantTelemetryListener
|
||||
Logger logger.Logger
|
||||
Reporter roomobs.TrackReporter
|
||||
SimTracks map[uint32]interceptor.SimulcastTrackInfo
|
||||
@@ -124,7 +123,7 @@ func NewMediaTrack(params MediaTrackParams, ti *livekit.TrackInfo) *MediaTrack {
|
||||
ReceiverConfig: params.ReceiverConfig,
|
||||
SubscriberConfig: params.SubscriberConfig,
|
||||
AudioConfig: params.AudioConfig,
|
||||
Telemetry: params.Telemetry,
|
||||
TelemetryListener: params.TelemetryListener,
|
||||
Logger: params.Logger,
|
||||
RegressionTargetCodec: t.regressionTargetCodec,
|
||||
PreferVideoSizeFromMedia: params.PreferVideoSizeFromMedia,
|
||||
@@ -445,7 +444,7 @@ func (t *MediaTrack) AddReceiver(receiver *webrtc.RTPReceiver, track sfu.TrackRe
|
||||
regressionTargetCodecReceived := t.regressionTargetCodecReceived
|
||||
t.lock.RUnlock()
|
||||
if priority == 0 || regressionTargetCodecReceived {
|
||||
t.params.Telemetry.TrackStats(statsKey, stat)
|
||||
t.params.TelemetryListener.OnTrackStats(statsKey, stat)
|
||||
|
||||
if cs, ok := telemetry.CondenseStat(stat); ok {
|
||||
t.params.Reporter.Tx(func(tx roomobs.TrackTx) {
|
||||
@@ -587,8 +586,7 @@ func (t *MediaTrack) AddReceiver(receiver *webrtc.RTPReceiver, track sfu.TrackRe
|
||||
})
|
||||
|
||||
buff.OnFinalRtpStats(func(stats *livekit.RTPStats) {
|
||||
t.params.Telemetry.TrackPublishRTPStats(
|
||||
context.Background(),
|
||||
t.params.TelemetryListener.OnTrackPublishRTPStats(
|
||||
t.params.ParticipantID(),
|
||||
t.ID(),
|
||||
mimeType,
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
package rtc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"slices"
|
||||
@@ -37,7 +36,6 @@ import (
|
||||
"github.com/livekit/livekit-server/pkg/sfu"
|
||||
"github.com/livekit/livekit-server/pkg/sfu/buffer"
|
||||
"github.com/livekit/livekit-server/pkg/sfu/rtpstats"
|
||||
"github.com/livekit/livekit-server/pkg/telemetry"
|
||||
sutils "github.com/livekit/livekit-server/pkg/utils"
|
||||
)
|
||||
|
||||
@@ -127,7 +125,7 @@ type MediaTrackReceiverParams struct {
|
||||
ReceiverConfig ReceiverConfig
|
||||
SubscriberConfig DirectionConfig
|
||||
AudioConfig sfu.AudioConfig
|
||||
Telemetry telemetry.TelemetryService
|
||||
TelemetryListener types.ParticipantTelemetryListener
|
||||
Logger logger.Logger
|
||||
RegressionTargetCodec mime.MimeType
|
||||
PreferVideoSizeFromMedia bool
|
||||
@@ -159,12 +157,12 @@ func NewMediaTrackReceiver(params MediaTrackReceiverParams, ti *livekit.TrackInf
|
||||
t.trackInfo.Store(utils.CloneProto(ti))
|
||||
|
||||
t.MediaTrackSubscriptions = NewMediaTrackSubscriptions(MediaTrackSubscriptionsParams{
|
||||
MediaTrack: params.MediaTrack,
|
||||
IsRelayed: params.IsRelayed,
|
||||
ReceiverConfig: params.ReceiverConfig,
|
||||
SubscriberConfig: params.SubscriberConfig,
|
||||
Telemetry: params.Telemetry,
|
||||
Logger: params.Logger,
|
||||
MediaTrack: params.MediaTrack,
|
||||
IsRelayed: params.IsRelayed,
|
||||
ReceiverConfig: params.ReceiverConfig,
|
||||
SubscriberConfig: params.SubscriberConfig,
|
||||
TelemetryListener: params.TelemetryListener,
|
||||
Logger: params.Logger,
|
||||
})
|
||||
t.MediaTrackSubscriptions.OnDownTrackCreated(t.onDownTrackCreated)
|
||||
return t
|
||||
@@ -937,7 +935,7 @@ func (t *MediaTrackReceiver) UpdateAudioTrack(update *livekit.UpdateLocalAudioTr
|
||||
|
||||
t.updateTrackInfoOfReceivers()
|
||||
|
||||
t.params.Telemetry.TrackPublishedUpdate(context.Background(), t.PublisherID(), clonedInfo)
|
||||
t.params.TelemetryListener.OnTrackPublishedUpdate(t.PublisherID(), clonedInfo)
|
||||
t.params.Logger.Debugw("updated audio track", "before", logger.Proto(trackInfo), "after", logger.Proto(clonedInfo))
|
||||
}
|
||||
|
||||
@@ -961,7 +959,7 @@ func (t *MediaTrackReceiver) UpdateVideoTrack(update *livekit.UpdateLocalVideoTr
|
||||
|
||||
t.updateTrackInfoOfReceivers()
|
||||
|
||||
t.params.Telemetry.TrackPublishedUpdate(context.Background(), t.PublisherID(), clonedInfo)
|
||||
t.params.TelemetryListener.OnTrackPublishedUpdate(t.PublisherID(), clonedInfo)
|
||||
t.params.Logger.Debugw("updated video track", "before", logger.Proto(trackInfo), "after", logger.Proto(clonedInfo))
|
||||
}
|
||||
|
||||
@@ -1007,7 +1005,7 @@ func (t *MediaTrackReceiver) UpdateVideoSize(mimeType mime.MimeType, sizes []buf
|
||||
|
||||
t.updateTrackInfoOfReceivers()
|
||||
|
||||
t.params.Telemetry.TrackPublishedUpdate(context.Background(), t.PublisherID(), clonedInfo)
|
||||
t.params.TelemetryListener.OnTrackPublishedUpdate(t.PublisherID(), clonedInfo)
|
||||
t.params.Logger.Debugw("updated video sizes", "before", logger.Proto(trackInfo), "after", logger.Proto(clonedInfo))
|
||||
}
|
||||
|
||||
@@ -1038,7 +1036,7 @@ func (t *MediaTrackReceiver) NotifyMaxLayerChange(mimeType mime.MimeType, maxLay
|
||||
}
|
||||
}
|
||||
|
||||
t.params.Telemetry.TrackPublishedUpdate(context.Background(), t.PublisherID(), ti)
|
||||
t.params.TelemetryListener.OnTrackPublishedUpdate(t.PublisherID(), ti)
|
||||
}
|
||||
|
||||
// GetQualityForDimension finds the closest quality to use for desired dimensions
|
||||
|
||||
@@ -27,7 +27,6 @@ import (
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||
"github.com/livekit/livekit-server/pkg/sfu"
|
||||
"github.com/livekit/livekit-server/pkg/telemetry"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -54,7 +53,7 @@ type MediaTrackSubscriptionsParams struct {
|
||||
ReceiverConfig ReceiverConfig
|
||||
SubscriberConfig DirectionConfig
|
||||
|
||||
Telemetry telemetry.TelemetryService
|
||||
TelemetryListener types.ParticipantTelemetryListener
|
||||
|
||||
Logger logger.Logger
|
||||
}
|
||||
@@ -112,7 +111,7 @@ func (t *MediaTrackSubscriptions) AddSubscriber(sub types.LocalParticipant, wr *
|
||||
Subscriber: sub,
|
||||
MediaTrack: t.params.MediaTrack,
|
||||
AdaptiveStream: sub.GetAdaptiveStream(),
|
||||
Telemetry: t.params.Telemetry,
|
||||
TelemetryListener: t.params.TelemetryListener,
|
||||
WrappedReceiver: wr,
|
||||
IsRelayed: t.params.IsRelayed,
|
||||
OnDownTrackCreated: t.onDownTrackCreated,
|
||||
|
||||
+14
-19
@@ -15,7 +15,6 @@
|
||||
package rtc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"math/rand"
|
||||
@@ -169,7 +168,7 @@ type ParticipantParams struct {
|
||||
LimitConfig config.LimitConfig
|
||||
ProtocolVersion types.ProtocolVersion
|
||||
SessionStartTime time.Time
|
||||
Telemetry telemetry.TelemetryService
|
||||
TelemetryListener types.ParticipantTelemetryListener
|
||||
Trailer []byte
|
||||
PLIThrottleConfig sfu.PLIThrottleConfig
|
||||
CongestionControlConfig config.CongestionControlConfig
|
||||
@@ -287,7 +286,7 @@ type ParticipantImpl struct {
|
||||
updateCache *lru.Cache[livekit.ParticipantID, participantUpdateInfo]
|
||||
updateLock utils.Mutex
|
||||
|
||||
dataChannelStats *telemetry.BytesTrackStats
|
||||
dataChannelStats *BytesTrackStats
|
||||
|
||||
reliableDataInfo reliableDataInfo
|
||||
|
||||
@@ -373,11 +372,11 @@ func NewParticipant(params ParticipantParams) (*ParticipantImpl, error) {
|
||||
p.setupSignalling()
|
||||
|
||||
p.id.Store(params.SID)
|
||||
p.dataChannelStats = telemetry.NewBytesTrackStats(
|
||||
p.dataChannelStats = NewBytesTrackStats(
|
||||
p.params.Country,
|
||||
telemetry.BytesTrackIDForParticipantID(telemetry.BytesTrackTypeData, p.ID()),
|
||||
BytesTrackIDForParticipantID(BytesTrackTypeData, p.ID()),
|
||||
p.ID(),
|
||||
params.Telemetry,
|
||||
params.TelemetryListener,
|
||||
params.Reporter,
|
||||
)
|
||||
p.reliableDataInfo.lastPubReliableSeq.Store(params.LastPubReliableSeq)
|
||||
@@ -2038,7 +2037,7 @@ func (p *ParticipantImpl) setupSubscriptionManager() {
|
||||
DataTrackResolver: func(lp types.LocalParticipant, ti livekit.TrackID) types.DataResolverResult {
|
||||
return p.helper().ResolveDataTrack(lp, ti)
|
||||
},
|
||||
Telemetry: p.params.Telemetry,
|
||||
TelemetryListener: p.params.TelemetryListener,
|
||||
OnTrackSubscribed: p.onTrackSubscribed,
|
||||
OnTrackUnsubscribed: p.onTrackUnsubscribed,
|
||||
OnSubscriptionError: p.onSubscriptionError,
|
||||
@@ -2721,8 +2720,7 @@ func (p *ParticipantImpl) onSubscribedMaxQualityChange(
|
||||
break
|
||||
}
|
||||
}
|
||||
p.params.Telemetry.TrackMaxSubscribedVideoQuality(
|
||||
context.Background(),
|
||||
p.params.TelemetryListener.OnTrackMaxSubscribedVideoQuality(
|
||||
p.ID(),
|
||||
ti,
|
||||
maxSubscribedQuality.CodecMime,
|
||||
@@ -2961,7 +2959,7 @@ func (p *ParticipantImpl) addPendingTrackLocked(req *livekit.AddTrackRequest) *l
|
||||
}
|
||||
}
|
||||
|
||||
p.params.Telemetry.TrackPublishRequested(context.Background(), p.ID(), p.Identity(), utils.CloneProto(ti))
|
||||
p.params.TelemetryListener.OnTrackPublishRequested(p.ID(), p.Identity(), utils.CloneProto(ti))
|
||||
|
||||
if p.supervisor != nil {
|
||||
p.supervisor.AddPublication(livekit.TrackID(ti.Sid))
|
||||
@@ -3072,9 +3070,9 @@ func (p *ParticipantImpl) setTrackMuted(mute *livekit.MuteTrackRequest, fromAdmi
|
||||
|
||||
if trackInfo != nil && changed {
|
||||
if mute.Muted {
|
||||
p.params.Telemetry.TrackMuted(context.Background(), p.ID(), trackInfo)
|
||||
p.params.TelemetryListener.OnTrackMuted(p.ID(), trackInfo)
|
||||
} else {
|
||||
p.params.Telemetry.TrackUnmuted(context.Background(), p.ID(), trackInfo)
|
||||
p.params.TelemetryListener.OnTrackUnmuted(p.ID(), trackInfo)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3291,7 +3289,7 @@ func (p *ParticipantImpl) addMediaTrack(signalCid string, ti *livekit.TrackInfo)
|
||||
ReceiverConfig: p.params.Config.Receiver,
|
||||
AudioConfig: p.params.AudioConfig,
|
||||
VideoConfig: p.params.VideoConfig,
|
||||
Telemetry: p.params.Telemetry,
|
||||
TelemetryListener: p.params.TelemetryListener,
|
||||
Logger: LoggerWithTrack(p.pubLogger, livekit.TrackID(ti.Sid), false),
|
||||
Reporter: p.params.Reporter.WithTrack(ti.Sid),
|
||||
SubscriberConfig: p.params.Config.Subscriber,
|
||||
@@ -3343,8 +3341,7 @@ func (p *ParticipantImpl) addMediaTrack(signalCid string, ti *livekit.TrackInfo)
|
||||
p.supervisor.ClearPublishedTrack(trackID, mt)
|
||||
}
|
||||
|
||||
p.params.Telemetry.TrackUnpublished(
|
||||
context.Background(),
|
||||
p.params.TelemetryListener.OnTrackUnpublished(
|
||||
p.ID(),
|
||||
p.Identity(),
|
||||
mt.ToProto(),
|
||||
@@ -3378,8 +3375,7 @@ func (p *ParticipantImpl) handleTrackPublished(track types.MediaTrack, isMigrate
|
||||
|
||||
// send webhook after callbacks are complete, persistence and state handling happens
|
||||
// in `onTrackPublished` cb
|
||||
p.params.Telemetry.TrackPublished(
|
||||
context.Background(),
|
||||
p.params.TelemetryListener.OnTrackPublished(
|
||||
p.ID(),
|
||||
p.Identity(),
|
||||
track.ToProto(),
|
||||
@@ -4012,8 +4008,7 @@ func (p *ParticipantImpl) MoveToRoom(params types.MoveToRoomParams) {
|
||||
track.(types.LocalMediaTrack).ClearSubscriberNodes()
|
||||
|
||||
trackInfo := track.ToProto()
|
||||
p.params.Telemetry.TrackUnpublished(
|
||||
context.Background(),
|
||||
p.params.TelemetryListener.OnTrackUnpublished(
|
||||
p.ID(),
|
||||
p.Identity(),
|
||||
trackInfo,
|
||||
|
||||
@@ -26,7 +26,6 @@ import (
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/sfu/buffer"
|
||||
"github.com/livekit/livekit-server/pkg/telemetry/telemetryfakes"
|
||||
"github.com/livekit/protocol/auth"
|
||||
protoCodecs "github.com/livekit/protocol/codecs"
|
||||
"github.com/livekit/protocol/codecs/mime"
|
||||
@@ -813,7 +812,7 @@ func newParticipantForTestWithOpts(identity livekit.ParticipantIdentity, opts *p
|
||||
ClientInfo: ClientInfo{ClientInfo: opts.clientInfo},
|
||||
Logger: LoggerWithParticipant(logger.GetLogger(), identity, sid, false),
|
||||
Reporter: roomobs.NewNoopParticipantSessionReporter(),
|
||||
Telemetry: &telemetryfakes.FakeTelemetryService{},
|
||||
TelemetryListener: &typesfakes.FakeParticipantTelemetryListener{},
|
||||
VersionGenerator: utils.NewDefaultTimedVersionGenerator(),
|
||||
ParticipantListener: &typesfakes.FakeLocalParticipantListener{},
|
||||
ParticipantHelper: &typesfakes.FakeLocalParticipantHelper{},
|
||||
|
||||
+75
-2
@@ -28,6 +28,7 @@ import (
|
||||
"golang.org/x/exp/maps"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"github.com/livekit/protocol/codecs/mime"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/livekit/protocol/logger"
|
||||
"github.com/livekit/protocol/observability/roomobs"
|
||||
@@ -147,8 +148,9 @@ type Room struct {
|
||||
|
||||
dataMessageCache *utils.TimeSizeCache[types.DataMessageCache]
|
||||
|
||||
onStateChangeMu sync.Mutex
|
||||
localParticipantListener types.LocalParticipantListener
|
||||
onStateChangeMu sync.Mutex
|
||||
localParticipantListener types.LocalParticipantListener
|
||||
participantTelemetryListener types.ParticipantTelemetryListener
|
||||
}
|
||||
|
||||
type ParticipantOptions struct {
|
||||
@@ -286,6 +288,7 @@ func NewRoom(
|
||||
}
|
||||
r.trackManager = NewRoomTrackManager(r.logger)
|
||||
r.localParticipantListener = &localParticipantListener{room: r}
|
||||
r.participantTelemetryListener = &participantTelemetryListener{room: r}
|
||||
|
||||
if r.protoRoom.EmptyTimeout == 0 {
|
||||
r.protoRoom.EmptyTimeout = roomConfig.EmptyTimeout
|
||||
@@ -1890,6 +1893,10 @@ func (r *Room) LocalParticipantListener() types.LocalParticipantListener {
|
||||
return r.localParticipantListener
|
||||
}
|
||||
|
||||
func (r *Room) ParticipantTelemetryListener() types.ParticipantTelemetryListener {
|
||||
return r.participantTelemetryListener
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
||||
var _ types.LocalParticipantListener = (*localParticipantListener)(nil)
|
||||
@@ -1983,6 +1990,72 @@ func (l *localParticipantListener) OnLeave(p types.LocalParticipant, closeReason
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
||||
var _ types.ParticipantTelemetryListener = (*participantTelemetryListener)(nil)
|
||||
|
||||
type participantTelemetryListener struct {
|
||||
room *Room
|
||||
}
|
||||
|
||||
func (l participantTelemetryListener) OnTrackPublishRequested(pID livekit.ParticipantID, identity livekit.ParticipantIdentity, ti *livekit.TrackInfo) {
|
||||
l.room.telemetry.TrackPublishRequested(context.Background(), l.room.ID(), l.room.Name(), pID, identity, ti)
|
||||
}
|
||||
|
||||
func (l participantTelemetryListener) OnTrackPublished(pID livekit.ParticipantID, identity livekit.ParticipantIdentity, ti *livekit.TrackInfo, shouldSendEvent bool) {
|
||||
l.room.telemetry.TrackPublished(context.Background(), l.room.ID(), l.room.Name(), pID, identity, ti, shouldSendEvent)
|
||||
}
|
||||
|
||||
func (l participantTelemetryListener) OnTrackUnpublished(pID livekit.ParticipantID, identity livekit.ParticipantIdentity, ti *livekit.TrackInfo, shouldSendEvent bool) {
|
||||
l.room.telemetry.TrackUnpublished(context.Background(), l.room.ID(), l.room.Name(), pID, identity, ti, shouldSendEvent)
|
||||
}
|
||||
|
||||
func (l participantTelemetryListener) OnTrackSubscribeRequested(pID livekit.ParticipantID, ti *livekit.TrackInfo) {
|
||||
l.room.telemetry.TrackSubscribeRequested(context.Background(), l.room.ID(), l.room.Name(), pID, ti)
|
||||
}
|
||||
|
||||
func (l participantTelemetryListener) OnTrackSubscribed(pID livekit.ParticipantID, ti *livekit.TrackInfo, publisherInfo *livekit.ParticipantInfo, shouldSendEvent bool) {
|
||||
l.room.telemetry.TrackSubscribed(context.Background(), l.room.ID(), l.room.Name(), pID, ti, publisherInfo, shouldSendEvent)
|
||||
}
|
||||
|
||||
func (l participantTelemetryListener) OnTrackUnsubscribed(pID livekit.ParticipantID, ti *livekit.TrackInfo, shouldSendEvent bool) {
|
||||
l.room.telemetry.TrackUnsubscribed(context.Background(), l.room.ID(), l.room.Name(), pID, ti, shouldSendEvent)
|
||||
}
|
||||
|
||||
func (l participantTelemetryListener) OnTrackSubscribeFailed(pID livekit.ParticipantID, ti livekit.TrackID, err error, isUserError bool) {
|
||||
l.room.telemetry.TrackSubscribeFailed(context.Background(), l.room.ID(), l.room.Name(), pID, ti, err, isUserError)
|
||||
}
|
||||
|
||||
func (l participantTelemetryListener) OnTrackMuted(pID livekit.ParticipantID, ti *livekit.TrackInfo) {
|
||||
l.room.telemetry.TrackMuted(context.Background(), l.room.ID(), l.room.Name(), pID, ti)
|
||||
}
|
||||
|
||||
func (l participantTelemetryListener) OnTrackUnmuted(pID livekit.ParticipantID, ti *livekit.TrackInfo) {
|
||||
l.room.telemetry.TrackUnmuted(context.Background(), l.room.ID(), l.room.Name(), pID, ti)
|
||||
}
|
||||
|
||||
func (l participantTelemetryListener) OnTrackPublishedUpdate(pID livekit.ParticipantID, ti *livekit.TrackInfo) {
|
||||
l.room.telemetry.TrackPublishedUpdate(context.Background(), l.room.ID(), l.room.Name(), pID, ti)
|
||||
}
|
||||
|
||||
func (l participantTelemetryListener) OnTrackMaxSubscribedVideoQuality(pID livekit.ParticipantID, ti *livekit.TrackInfo, mime mime.MimeType, maxQuality livekit.VideoQuality) {
|
||||
l.room.telemetry.TrackMaxSubscribedVideoQuality(context.Background(), l.room.ID(), l.room.Name(), pID, ti, mime, maxQuality)
|
||||
}
|
||||
|
||||
func (l participantTelemetryListener) OnTrackPublishRTPStats(pID livekit.ParticipantID, trackID livekit.TrackID, mimeType mime.MimeType, layer int, stats *livekit.RTPStats) {
|
||||
l.room.telemetry.TrackPublishRTPStats(context.Background(), l.room.ID(), l.room.Name(), pID, trackID, mimeType, layer, stats)
|
||||
}
|
||||
|
||||
func (l participantTelemetryListener) OnTrackSubscribeRTPStats(pID livekit.ParticipantID, trackID livekit.TrackID, mimeType mime.MimeType, stats *livekit.RTPStats) {
|
||||
l.room.telemetry.TrackSubscribeRTPStats(context.Background(), l.room.ID(), l.room.Name(), pID, trackID, mimeType, stats)
|
||||
}
|
||||
|
||||
func (l participantTelemetryListener) OnTrackStats(key telemetry.StatsKey, stat *livekit.AnalyticsStat) {
|
||||
roomID, roomName := l.room.ID(), l.room.Name()
|
||||
stat.RoomId, stat.RoomName = string(roomID), string(roomName)
|
||||
l.room.telemetry.TrackStats(roomID, roomName, key, stat)
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
||||
func BroadcastDataPacketForRoom(
|
||||
r types.Room,
|
||||
source types.LocalParticipant,
|
||||
|
||||
@@ -0,0 +1,293 @@
|
||||
// Copyright 2023 LiveKit, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package rtc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/frostbyte73/core"
|
||||
"go.uber.org/atomic"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||
"github.com/livekit/livekit-server/pkg/telemetry"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/livekit/protocol/observability/roomobs"
|
||||
"github.com/livekit/protocol/utils"
|
||||
)
|
||||
|
||||
type BytesTrackType string
|
||||
|
||||
const (
|
||||
BytesTrackTypeData BytesTrackType = "DT"
|
||||
BytesTrackTypeSignal BytesTrackType = "SG"
|
||||
)
|
||||
|
||||
// -------------------------------
|
||||
|
||||
type TrafficTotals struct {
|
||||
At time.Time
|
||||
SendBytes uint64
|
||||
SendMessages uint32
|
||||
RecvBytes uint64
|
||||
RecvMessages uint32
|
||||
}
|
||||
|
||||
// --------------------------------
|
||||
|
||||
// stats for signal and data channel
|
||||
type BytesTrackStats struct {
|
||||
country string
|
||||
pID livekit.ParticipantID
|
||||
trackID livekit.TrackID
|
||||
send, recv atomic.Uint64
|
||||
sendMessages, recvMessages atomic.Uint32
|
||||
totalSendBytes, totalRecvBytes atomic.Uint64
|
||||
totalSendMessages, totalRecvMessages atomic.Uint32
|
||||
telemetryListener types.ParticipantTelemetryListener
|
||||
reporter roomobs.TrackReporter
|
||||
done core.Fuse
|
||||
}
|
||||
|
||||
func NewBytesTrackStats(
|
||||
country string,
|
||||
trackID livekit.TrackID,
|
||||
pID livekit.ParticipantID,
|
||||
telemetryListener types.ParticipantTelemetryListener,
|
||||
participantReporter roomobs.ParticipantSessionReporter,
|
||||
) *BytesTrackStats {
|
||||
s := &BytesTrackStats{
|
||||
country: country,
|
||||
pID: pID,
|
||||
trackID: trackID,
|
||||
telemetryListener: telemetryListener,
|
||||
reporter: participantReporter.WithTrack(trackID.String()),
|
||||
}
|
||||
go s.worker()
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *BytesTrackStats) AddBytes(bytes uint64, isSend bool) {
|
||||
if isSend {
|
||||
s.send.Add(bytes)
|
||||
s.sendMessages.Inc()
|
||||
s.totalSendBytes.Add(bytes)
|
||||
s.totalSendMessages.Inc()
|
||||
|
||||
s.reporter.Tx(func(tx roomobs.TrackTx) {
|
||||
tx.ReportType(roomobs.TrackTypeData)
|
||||
tx.ReportSendBytes(uint32(bytes))
|
||||
tx.ReportSendPackets(1)
|
||||
})
|
||||
} else {
|
||||
s.recv.Add(bytes)
|
||||
s.recvMessages.Inc()
|
||||
s.totalRecvBytes.Add(bytes)
|
||||
s.totalRecvMessages.Inc()
|
||||
|
||||
s.reporter.Tx(func(tx roomobs.TrackTx) {
|
||||
tx.ReportType(roomobs.TrackTypeData)
|
||||
tx.ReportRecvBytes(uint32(bytes))
|
||||
tx.ReportRecvPackets(1)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *BytesTrackStats) GetTrafficTotals() *TrafficTotals {
|
||||
return &TrafficTotals{
|
||||
At: time.Now(),
|
||||
SendBytes: s.totalSendBytes.Load(),
|
||||
SendMessages: s.totalSendMessages.Load(),
|
||||
RecvBytes: s.totalRecvBytes.Load(),
|
||||
RecvMessages: s.totalRecvMessages.Load(),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *BytesTrackStats) Stop() {
|
||||
s.done.Break()
|
||||
}
|
||||
|
||||
func (s *BytesTrackStats) report() {
|
||||
if recv := s.recv.Swap(0); recv > 0 {
|
||||
packets := s.recvMessages.Swap(0)
|
||||
s.telemetryListener.OnTrackStats(
|
||||
telemetry.StatsKeyForData(s.country, livekit.StreamType_UPSTREAM, s.pID, s.trackID),
|
||||
&livekit.AnalyticsStat{
|
||||
Streams: []*livekit.AnalyticsStream{
|
||||
{
|
||||
PrimaryBytes: recv,
|
||||
PrimaryPackets: packets,
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
if send := s.send.Swap(0); send > 0 {
|
||||
packets := s.sendMessages.Swap(0)
|
||||
s.telemetryListener.OnTrackStats(
|
||||
telemetry.StatsKeyForData(s.country, livekit.StreamType_DOWNSTREAM, s.pID, s.trackID),
|
||||
&livekit.AnalyticsStat{
|
||||
Streams: []*livekit.AnalyticsStream{
|
||||
{
|
||||
PrimaryBytes: send,
|
||||
PrimaryPackets: packets,
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *BytesTrackStats) worker() {
|
||||
ticker := time.NewTicker(5 * time.Second)
|
||||
defer func() {
|
||||
ticker.Stop()
|
||||
s.report()
|
||||
}()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-s.done.Watch():
|
||||
return
|
||||
case <-ticker.C:
|
||||
s.report()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
var _ types.ParticipantTelemetryListener = (*BytesSignalStats)(nil)
|
||||
|
||||
type BytesSignalStats struct {
|
||||
BytesTrackStats
|
||||
ctx context.Context
|
||||
|
||||
telemetry telemetry.TelemetryService
|
||||
guard *telemetry.ReferenceGuard
|
||||
|
||||
participantResolver roomobs.ParticipantReporterResolver
|
||||
trackResolver roomobs.KeyResolver
|
||||
|
||||
mu sync.Mutex
|
||||
ri *livekit.Room
|
||||
pi *livekit.ParticipantInfo
|
||||
stopped chan struct{}
|
||||
|
||||
types.NullParticipantTelemetryListener
|
||||
}
|
||||
|
||||
func NewBytesSignalStats(
|
||||
ctx context.Context,
|
||||
telemetryService telemetry.TelemetryService,
|
||||
) *BytesSignalStats {
|
||||
projectReporter := telemetryService.RoomProjectReporter(ctx)
|
||||
participantReporter, participantReporterResolver := roomobs.DeferredParticipantReporter(projectReporter)
|
||||
trackReporter, trackReporterResolver := participantReporter.WithDeferredTrack()
|
||||
b := &BytesSignalStats{
|
||||
ctx: ctx,
|
||||
telemetry: telemetryService,
|
||||
guard: &telemetry.ReferenceGuard{},
|
||||
participantResolver: participantReporterResolver,
|
||||
trackResolver: trackReporterResolver,
|
||||
}
|
||||
b.BytesTrackStats = BytesTrackStats{
|
||||
telemetryListener: b,
|
||||
reporter: trackReporter,
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (s *BytesSignalStats) ResolveRoom(ri *livekit.Room) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
if s.ri == nil && ri.GetSid() != "" {
|
||||
s.ri = &livekit.Room{
|
||||
Sid: ri.Sid,
|
||||
Name: ri.Name,
|
||||
}
|
||||
s.maybeStart()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *BytesSignalStats) ResolveParticipant(pi *livekit.ParticipantInfo) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
if s.pi == nil && pi != nil {
|
||||
s.pi = &livekit.ParticipantInfo{
|
||||
Sid: pi.Sid,
|
||||
Identity: pi.Identity,
|
||||
}
|
||||
s.maybeStart()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *BytesSignalStats) Reset() {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
if s.stopped != nil {
|
||||
s.done.Break()
|
||||
<-s.stopped
|
||||
s.stopped = nil
|
||||
s.done = core.Fuse{}
|
||||
s.guard = &telemetry.ReferenceGuard{}
|
||||
}
|
||||
s.ri = nil
|
||||
s.pi = nil
|
||||
|
||||
s.participantResolver.Reset()
|
||||
s.trackResolver.Reset()
|
||||
}
|
||||
|
||||
func (s *BytesSignalStats) maybeStart() {
|
||||
if s.ri == nil || s.pi == nil {
|
||||
return
|
||||
}
|
||||
|
||||
s.pID = livekit.ParticipantID(s.pi.Sid)
|
||||
s.trackID = BytesTrackIDForParticipantID(BytesTrackTypeSignal, s.pID)
|
||||
|
||||
s.participantResolver.Resolve(
|
||||
livekit.RoomName(s.ri.Name),
|
||||
livekit.RoomID(s.ri.Sid),
|
||||
livekit.ParticipantIdentity(s.pi.Identity),
|
||||
livekit.ParticipantID(s.pi.Sid),
|
||||
)
|
||||
s.trackResolver.Resolve(string(s.trackID))
|
||||
|
||||
s.telemetry.ParticipantJoined(s.ctx, s.ri, s.pi, nil, nil, false, s.guard)
|
||||
s.stopped = make(chan struct{})
|
||||
go s.worker()
|
||||
}
|
||||
|
||||
func (s *BytesSignalStats) worker() {
|
||||
s.BytesTrackStats.worker()
|
||||
s.telemetry.ParticipantLeft(s.ctx, s.ri, s.pi, false, s.guard)
|
||||
close(s.stopped)
|
||||
}
|
||||
|
||||
func (s *BytesSignalStats) OnTrackStats(key telemetry.StatsKey, stat *livekit.AnalyticsStat) {
|
||||
stat.RoomId, stat.RoomName = s.ri.Sid, s.ri.Name
|
||||
s.telemetry.TrackStats(livekit.RoomID(s.ri.Sid), livekit.RoomName(s.ri.Name), key, stat)
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
func BytesTrackIDForParticipantID(typ BytesTrackType, participantID livekit.ParticipantID) livekit.TrackID {
|
||||
return livekit.TrackID(fmt.Sprintf("%s%s%s", utils.TrackPrefix, typ, participantID))
|
||||
}
|
||||
@@ -48,7 +48,7 @@ type SubscribedTrackParams struct {
|
||||
Subscriber types.LocalParticipant
|
||||
MediaTrack types.MediaTrack
|
||||
AdaptiveStream bool
|
||||
Telemetry telemetry.TelemetryService
|
||||
TelemetryListener types.ParticipantTelemetryListener
|
||||
WrappedReceiver *WrappedReceiver
|
||||
IsRelayed bool
|
||||
OnDownTrackCreated func(downTrack *sfu.DownTrack)
|
||||
@@ -403,7 +403,7 @@ func (t *SubscribedTrack) OnBindAndConnected() {
|
||||
}
|
||||
|
||||
func (t *SubscribedTrack) OnStatsUpdate(stat *livekit.AnalyticsStat) {
|
||||
t.params.Telemetry.TrackStats(t.statsKey, stat)
|
||||
t.params.TelemetryListener.OnTrackStats(t.statsKey, stat)
|
||||
|
||||
if cs, ok := telemetry.CondenseStat(stat); ok {
|
||||
ti := t.params.WrappedReceiver.TrackInfo()
|
||||
|
||||
@@ -28,7 +28,6 @@ import (
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||
"github.com/livekit/livekit-server/pkg/sfu"
|
||||
"github.com/livekit/livekit-server/pkg/telemetry"
|
||||
"github.com/livekit/livekit-server/pkg/telemetry/prometheus"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/livekit/protocol/logger"
|
||||
@@ -57,7 +56,7 @@ type SubscriptionManagerParams struct {
|
||||
OnTrackSubscribed func(subTrack types.SubscribedTrack)
|
||||
OnTrackUnsubscribed func(subTrack types.SubscribedTrack)
|
||||
OnSubscriptionError func(trackID livekit.TrackID, fatal bool, err error)
|
||||
Telemetry telemetry.TelemetryService
|
||||
TelemetryListener types.ParticipantTelemetryListener
|
||||
|
||||
SubscriptionLimitVideo, SubscriptionLimitAudio int32
|
||||
|
||||
@@ -472,8 +471,7 @@ func (m *SubscriptionManager) reconcileSubscription(s *mediaTrackSubscription) {
|
||||
|
||||
numAttempts := s.getNumAttempts()
|
||||
if numAttempts == 0 {
|
||||
m.params.Telemetry.TrackSubscribeRequested(
|
||||
context.Background(),
|
||||
m.params.TelemetryListener.OnTrackSubscribeRequested(
|
||||
s.subscriberID,
|
||||
&livekit.TrackInfo{
|
||||
Sid: string(s.trackID),
|
||||
@@ -493,14 +491,14 @@ func (m *SubscriptionManager) reconcileSubscription(s *mediaTrackSubscription) {
|
||||
// - ErrSubscriptionLimitExceeded: the participant have reached the limit of subscriptions, wait for the other subscription to be unsubscribed
|
||||
// We'll still log an event to reflect this in telemetry since it's been too long
|
||||
if s.durationSinceStart() > subscriptionTimeout {
|
||||
s.maybeRecordError(m.params.Telemetry, s.subscriberID, err, true)
|
||||
s.maybeRecordError(m.params.TelemetryListener, err, true)
|
||||
}
|
||||
case ErrTrackNotFound:
|
||||
// source track was never published or closed
|
||||
// if after timeout we'd unsubscribe from it.
|
||||
// this is the *only* case we'd change desired state
|
||||
if s.durationSinceStart() > notFoundTimeout {
|
||||
s.maybeRecordError(m.params.Telemetry, s.subscriberID, err, true)
|
||||
s.maybeRecordError(m.params.TelemetryListener, err, true)
|
||||
s.logger.Infow("unsubscribing from track after notFoundTimeout", "error", err)
|
||||
s.setDesired(false)
|
||||
m.queueReconcile(s.trackID)
|
||||
@@ -513,7 +511,7 @@ func (m *SubscriptionManager) reconcileSubscription(s *mediaTrackSubscription) {
|
||||
"failed to subscribe, triggering error handler", err,
|
||||
"attempt", s.getNumAttempts(),
|
||||
)
|
||||
s.maybeRecordError(m.params.Telemetry, s.subscriberID, err, false)
|
||||
s.maybeRecordError(m.params.TelemetryListener, err, false)
|
||||
m.params.OnSubscriptionError(s.trackID, true, err)
|
||||
} else {
|
||||
s.logger.Debugw(
|
||||
@@ -552,7 +550,7 @@ func (m *SubscriptionManager) reconcileSubscription(s *mediaTrackSubscription) {
|
||||
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)
|
||||
s.maybeRecordError(m.params.TelemetryListener, ErrTrackNotBound, false)
|
||||
m.params.OnSubscriptionError(s.trackID, true, ErrTrackNotBound)
|
||||
}
|
||||
}
|
||||
@@ -839,13 +837,13 @@ func (m *SubscriptionManager) addSubscriber(sub *mediaTrackSubscription, track t
|
||||
subTrack.AddOnBind(func(err error) {
|
||||
if err != nil {
|
||||
sub.logger.Infow("failed to bind track", "err", err)
|
||||
sub.maybeRecordError(m.params.Telemetry, sub.subscriberID, err, true)
|
||||
sub.maybeRecordError(m.params.TelemetryListener, err, true)
|
||||
m.UnsubscribeFromTrack(trackID)
|
||||
m.params.OnSubscriptionError(trackID, false, err)
|
||||
return
|
||||
}
|
||||
sub.setBound()
|
||||
sub.maybeRecordSuccess(m.params.Telemetry, sub.subscriberID)
|
||||
sub.maybeRecordSuccess(m.params.TelemetryListener)
|
||||
})
|
||||
sub.setSubscribedTrack(subTrack)
|
||||
|
||||
@@ -967,8 +965,7 @@ func (m *SubscriptionManager) handleSubscribedTrackClose(s *mediaTrackSubscripti
|
||||
// * the participant isn't closing
|
||||
// * it's not a migration
|
||||
if wasBound {
|
||||
m.params.Telemetry.TrackUnsubscribed(
|
||||
context.Background(),
|
||||
m.params.TelemetryListener.OnTrackUnsubscribed(
|
||||
s.subscriberID,
|
||||
&livekit.TrackInfo{Sid: string(s.trackID), Type: subTrack.MediaTrack().Kind()},
|
||||
!isExpectedToResume,
|
||||
@@ -978,8 +975,7 @@ func (m *SubscriptionManager) handleSubscribedTrackClose(s *mediaTrackSubscripti
|
||||
if dt != nil {
|
||||
stats := dt.GetTrackStats()
|
||||
if stats != nil {
|
||||
m.params.Telemetry.TrackSubscribeRTPStats(
|
||||
context.Background(),
|
||||
m.params.TelemetryListener.OnTrackSubscribeRTPStats(
|
||||
s.subscriberID,
|
||||
s.trackID,
|
||||
dt.Mime(),
|
||||
@@ -1437,15 +1433,15 @@ func (s *mediaTrackSubscription) isBound() bool {
|
||||
return s.bound
|
||||
}
|
||||
|
||||
func (s *mediaTrackSubscription) maybeRecordError(ts telemetry.TelemetryService, pID livekit.ParticipantID, err error, isUserError bool) {
|
||||
func (s *mediaTrackSubscription) maybeRecordError(tl types.ParticipantTelemetryListener, err error, isUserError bool) {
|
||||
if s.eventSent.Swap(true) {
|
||||
return
|
||||
}
|
||||
|
||||
ts.TrackSubscribeFailed(context.Background(), pID, s.trackID, err, isUserError)
|
||||
tl.OnTrackSubscribeFailed(s.subscriberID, s.trackID, err, isUserError)
|
||||
}
|
||||
|
||||
func (s *mediaTrackSubscription) maybeRecordSuccess(ts telemetry.TelemetryService, pID livekit.ParticipantID) {
|
||||
func (s *mediaTrackSubscription) maybeRecordSuccess(tl types.ParticipantTelemetryListener) {
|
||||
subTrack := s.getSubscribedTrack()
|
||||
if subTrack == nil {
|
||||
return
|
||||
@@ -1474,7 +1470,7 @@ func (s *mediaTrackSubscription) maybeRecordSuccess(ts telemetry.TelemetryServic
|
||||
Identity: string(subTrack.PublisherIdentity()),
|
||||
Sid: string(subTrack.PublisherID()),
|
||||
}
|
||||
ts.TrackSubscribed(context.Background(), pID, mediaTrack.ToProto(), pi, !eventSent)
|
||||
tl.OnTrackSubscribed(s.subscriberID, mediaTrack.ToProto(), pi, !eventSent)
|
||||
}
|
||||
|
||||
func (s *mediaTrackSubscription) isCanceled() bool {
|
||||
|
||||
@@ -26,7 +26,6 @@ import (
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||
"github.com/livekit/livekit-server/pkg/rtc/types/typesfakes"
|
||||
"github.com/livekit/livekit-server/pkg/telemetry/telemetryfakes"
|
||||
"github.com/livekit/livekit-server/pkg/utils"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/livekit/protocol/logger"
|
||||
@@ -83,8 +82,8 @@ func TestSubscribe(t *testing.T) {
|
||||
require.Equal(t, "pubID", string(sm.GetSubscribedParticipants()[0]))
|
||||
|
||||
// ensure telemetry events are sent
|
||||
tm := sm.params.Telemetry.(*telemetryfakes.FakeTelemetryService)
|
||||
require.Equal(t, 1, tm.TrackSubscribeRequestedCallCount())
|
||||
tl := sm.params.TelemetryListener.(*typesfakes.FakeParticipantTelemetryListener)
|
||||
require.Equal(t, 1, tl.OnTrackSubscribeRequestedCallCount())
|
||||
|
||||
// ensure bound
|
||||
setTestSubscribedTrackBound(t, s.getSubscribedTrack())
|
||||
@@ -93,7 +92,7 @@ func TestSubscribe(t *testing.T) {
|
||||
}, subSettleTimeout, subCheckInterval, "track was not bound")
|
||||
|
||||
// telemetry event should have been sent
|
||||
require.Equal(t, 1, tm.TrackSubscribedCallCount())
|
||||
require.Equal(t, 1, tl.OnTrackSubscribedCallCount())
|
||||
|
||||
time.Sleep(notFoundTimeout)
|
||||
require.False(t, failed.Load())
|
||||
@@ -142,9 +141,9 @@ func TestSubscribe(t *testing.T) {
|
||||
require.Len(t, sm.GetSubscribedTracks(), 0)
|
||||
|
||||
// trackSubscribed telemetry not sent
|
||||
tm := sm.params.Telemetry.(*telemetryfakes.FakeTelemetryService)
|
||||
require.Equal(t, 1, tm.TrackSubscribeRequestedCallCount())
|
||||
require.Equal(t, 0, tm.TrackSubscribedCallCount())
|
||||
tl := sm.params.TelemetryListener.(*typesfakes.FakeParticipantTelemetryListener)
|
||||
require.Equal(t, 1, tl.OnTrackSubscribeRequestedCallCount())
|
||||
require.Equal(t, 0, tl.OnTrackSubscribedCallCount())
|
||||
|
||||
// give permissions now
|
||||
resolver.lock.Lock()
|
||||
@@ -254,8 +253,8 @@ func TestUnsubscribe(t *testing.T) {
|
||||
require.Len(t, sm.GetSubscribedTracks(), 0)
|
||||
require.False(t, res.TrackChangedNotifier.HasObservers())
|
||||
|
||||
tm := sm.params.Telemetry.(*telemetryfakes.FakeTelemetryService)
|
||||
require.Equal(t, 1, tm.TrackUnsubscribedCallCount())
|
||||
tl := sm.params.TelemetryListener.(*typesfakes.FakeParticipantTelemetryListener)
|
||||
require.Equal(t, 1, tl.OnTrackUnsubscribedCallCount())
|
||||
}
|
||||
|
||||
func TestSubscribeStatusChanged(t *testing.T) {
|
||||
@@ -394,8 +393,8 @@ func TestSubscriptionLimits(t *testing.T) {
|
||||
require.Equal(t, "pubID", string(sm.GetSubscribedParticipants()[0]))
|
||||
|
||||
// ensure telemetry events are sent
|
||||
tm := sm.params.Telemetry.(*telemetryfakes.FakeTelemetryService)
|
||||
require.Equal(t, 1, tm.TrackSubscribeRequestedCallCount())
|
||||
tl := sm.params.TelemetryListener.(*typesfakes.FakeParticipantTelemetryListener)
|
||||
require.Equal(t, 1, tl.OnTrackSubscribeRequestedCallCount())
|
||||
|
||||
// ensure bound
|
||||
setTestSubscribedTrackBound(t, s.getSubscribedTrack())
|
||||
@@ -404,15 +403,15 @@ func TestSubscriptionLimits(t *testing.T) {
|
||||
}, subSettleTimeout, subCheckInterval, "track was not bound")
|
||||
|
||||
// telemetry event should have been sent
|
||||
require.Equal(t, 1, tm.TrackSubscribedCallCount())
|
||||
require.Equal(t, 1, tl.OnTrackSubscribedCallCount())
|
||||
|
||||
// reach subscription limit, subscribe pending
|
||||
sm.SubscribeToTrack("track2", false)
|
||||
s2 := sm.subscriptions["track2"]
|
||||
time.Sleep(subscriptionTimeout * 2)
|
||||
require.True(t, s2.needsSubscribe())
|
||||
require.Equal(t, 2, tm.TrackSubscribeRequestedCallCount())
|
||||
require.Equal(t, 1, tm.TrackSubscribeFailedCallCount())
|
||||
require.Equal(t, 2, tl.OnTrackSubscribeRequestedCallCount())
|
||||
require.Equal(t, 1, tl.OnTrackSubscribeFailedCallCount())
|
||||
require.Len(t, sm.GetSubscribedTracks(), 1)
|
||||
|
||||
// unsubscribe track1, then track2 should be subscribed
|
||||
@@ -429,7 +428,7 @@ func TestSubscriptionLimits(t *testing.T) {
|
||||
require.False(t, s2.needsSubscribe())
|
||||
require.EqualValues(t, 2, subCount.Load())
|
||||
require.NotNil(t, s2.getSubscribedTrack())
|
||||
require.Equal(t, 2, tm.TrackSubscribeRequestedCallCount())
|
||||
require.Equal(t, 2, tl.OnTrackSubscribeRequestedCallCount())
|
||||
require.Len(t, sm.GetSubscribedTracks(), 1)
|
||||
|
||||
// ensure bound
|
||||
@@ -444,8 +443,8 @@ func TestSubscriptionLimits(t *testing.T) {
|
||||
require.True(t, s.isDesired())
|
||||
time.Sleep(subscriptionTimeout * 2)
|
||||
require.True(t, s.needsSubscribe())
|
||||
require.Equal(t, 3, tm.TrackSubscribeRequestedCallCount())
|
||||
require.Equal(t, 2, tm.TrackSubscribeFailedCallCount())
|
||||
require.Equal(t, 3, tl.OnTrackSubscribeRequestedCallCount())
|
||||
require.Equal(t, 2, tl.OnTrackSubscribeFailedCallCount())
|
||||
require.Len(t, sm.GetSubscribedTracks(), 1)
|
||||
}
|
||||
|
||||
@@ -473,7 +472,7 @@ func newTestSubscriptionManagerWithParams(params testSubscriptionParams) *Subscr
|
||||
TrackResolver: func(sub types.LocalParticipant, trackID livekit.TrackID) types.MediaResolverResult {
|
||||
return types.MediaResolverResult{}
|
||||
},
|
||||
Telemetry: &telemetryfakes.FakeTelemetryService{},
|
||||
TelemetryListener: &typesfakes.FakeParticipantTelemetryListener{},
|
||||
SubscriptionLimitAudio: params.SubscriptionLimitAudio,
|
||||
SubscriptionLimitVideo: params.SubscriptionLimitVideo,
|
||||
})
|
||||
|
||||
@@ -41,7 +41,6 @@ import (
|
||||
"github.com/livekit/livekit-server/pkg/sfu/datachannel"
|
||||
"github.com/livekit/livekit-server/pkg/sfu/interceptor"
|
||||
"github.com/livekit/livekit-server/pkg/sfu/pacer"
|
||||
"github.com/livekit/livekit-server/pkg/telemetry"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -95,7 +94,7 @@ type TransportManagerParams struct {
|
||||
Logger logger.Logger
|
||||
PublisherHandler transport.Handler
|
||||
SubscriberHandler transport.Handler
|
||||
DataChannelStats *telemetry.BytesTrackStats
|
||||
DataChannelStats *BytesTrackStats
|
||||
UseOneShotSignallingMode bool
|
||||
FireOnTrackBySdp bool
|
||||
EnableDataTracks bool
|
||||
|
||||
@@ -636,6 +636,61 @@ func (*NullLocalParticipantListener) OnLeave(LocalParticipant, ParticipantCloseR
|
||||
|
||||
// ---------------------------------------------
|
||||
|
||||
//counterfeiter:generate . ParticipantTelemetryListener
|
||||
type ParticipantTelemetryListener interface {
|
||||
OnTrackPublishRequested(pID livekit.ParticipantID, identity livekit.ParticipantIdentity, ti *livekit.TrackInfo)
|
||||
OnTrackPublished(pID livekit.ParticipantID, identity livekit.ParticipantIdentity, ti *livekit.TrackInfo, shouldSendEvent bool)
|
||||
OnTrackUnpublished(pID livekit.ParticipantID, identity livekit.ParticipantIdentity, ti *livekit.TrackInfo, shouldSendEvent bool)
|
||||
OnTrackSubscribeRequested(pID livekit.ParticipantID, ti *livekit.TrackInfo)
|
||||
OnTrackSubscribed(pID livekit.ParticipantID, ti *livekit.TrackInfo, publisherInfo *livekit.ParticipantInfo, shouldSendEvent bool)
|
||||
OnTrackUnsubscribed(pID livekit.ParticipantID, ti *livekit.TrackInfo, shouldSendEvent bool)
|
||||
OnTrackSubscribeFailed(pID livekit.ParticipantID, ti livekit.TrackID, err error, isUserError bool)
|
||||
OnTrackMuted(pID livekit.ParticipantID, ti *livekit.TrackInfo)
|
||||
OnTrackUnmuted(pID livekit.ParticipantID, ti *livekit.TrackInfo)
|
||||
OnTrackPublishedUpdate(pID livekit.ParticipantID, ti *livekit.TrackInfo)
|
||||
OnTrackMaxSubscribedVideoQuality(pID livekit.ParticipantID, ti *livekit.TrackInfo, mime mime.MimeType, maxQuality livekit.VideoQuality)
|
||||
OnTrackPublishRTPStats(pID livekit.ParticipantID, trackID livekit.TrackID, mimeType mime.MimeType, layer int, stats *livekit.RTPStats)
|
||||
OnTrackSubscribeRTPStats(pID livekit.ParticipantID, trackID livekit.TrackID, mimeType mime.MimeType, stats *livekit.RTPStats)
|
||||
|
||||
OnTrackStats(key telemetry.StatsKey, stat *livekit.AnalyticsStat)
|
||||
}
|
||||
|
||||
var _ ParticipantTelemetryListener = (*NullParticipantTelemetryListener)(nil)
|
||||
|
||||
type NullParticipantTelemetryListener struct{}
|
||||
|
||||
func (NullParticipantTelemetryListener) OnTrackPublishRequested(pID livekit.ParticipantID, identity livekit.ParticipantIdentity, ti *livekit.TrackInfo) {
|
||||
}
|
||||
func (NullParticipantTelemetryListener) OnTrackPublished(pID livekit.ParticipantID, identity livekit.ParticipantIdentity, ti *livekit.TrackInfo, shouldSendEvent bool) {
|
||||
}
|
||||
func (NullParticipantTelemetryListener) OnTrackUnpublished(pID livekit.ParticipantID, identity livekit.ParticipantIdentity, ti *livekit.TrackInfo, shouldSendEvent bool) {
|
||||
}
|
||||
func (NullParticipantTelemetryListener) OnTrackSubscribeRequested(pID livekit.ParticipantID, ti *livekit.TrackInfo) {
|
||||
}
|
||||
func (NullParticipantTelemetryListener) OnTrackSubscribed(pID livekit.ParticipantID, ti *livekit.TrackInfo, publisherInfo *livekit.ParticipantInfo, shouldSendEvent bool) {
|
||||
}
|
||||
func (NullParticipantTelemetryListener) OnTrackUnsubscribed(pID livekit.ParticipantID, ti *livekit.TrackInfo, shouldSendEvent bool) {
|
||||
}
|
||||
func (NullParticipantTelemetryListener) OnTrackSubscribeFailed(pID livekit.ParticipantID, ti livekit.TrackID, err error, isUserError bool) {
|
||||
}
|
||||
func (NullParticipantTelemetryListener) OnTrackMuted(pID livekit.ParticipantID, ti *livekit.TrackInfo) {
|
||||
}
|
||||
func (NullParticipantTelemetryListener) OnTrackUnmuted(pID livekit.ParticipantID, ti *livekit.TrackInfo) {
|
||||
}
|
||||
func (NullParticipantTelemetryListener) OnTrackPublishedUpdate(pID livekit.ParticipantID, ti *livekit.TrackInfo) {
|
||||
}
|
||||
func (NullParticipantTelemetryListener) OnTrackMaxSubscribedVideoQuality(pID livekit.ParticipantID, ti *livekit.TrackInfo, mime mime.MimeType, maxQuality livekit.VideoQuality) {
|
||||
}
|
||||
func (NullParticipantTelemetryListener) OnTrackPublishRTPStats(pID livekit.ParticipantID, trackID livekit.TrackID, mimeType mime.MimeType, layer int, stats *livekit.RTPStats) {
|
||||
}
|
||||
func (NullParticipantTelemetryListener) OnTrackSubscribeRTPStats(pID livekit.ParticipantID, trackID livekit.TrackID, mimeType mime.MimeType, stats *livekit.RTPStats) {
|
||||
}
|
||||
|
||||
func (NullParticipantTelemetryListener) OnTrackStats(key telemetry.StatsKey, stat *livekit.AnalyticsStat) {
|
||||
}
|
||||
|
||||
// ---------------------------------------------
|
||||
|
||||
// Room is a container of participants, and can provide room-level actions
|
||||
//
|
||||
//counterfeiter:generate . Room
|
||||
|
||||
@@ -0,0 +1,620 @@
|
||||
// Code generated by counterfeiter. DO NOT EDIT.
|
||||
package typesfakes
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||
"github.com/livekit/livekit-server/pkg/telemetry"
|
||||
"github.com/livekit/protocol/codecs/mime"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
)
|
||||
|
||||
type FakeParticipantTelemetryListener struct {
|
||||
OnTrackMaxSubscribedVideoQualityStub func(livekit.ParticipantID, *livekit.TrackInfo, mime.MimeType, livekit.VideoQuality)
|
||||
onTrackMaxSubscribedVideoQualityMutex sync.RWMutex
|
||||
onTrackMaxSubscribedVideoQualityArgsForCall []struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 *livekit.TrackInfo
|
||||
arg3 mime.MimeType
|
||||
arg4 livekit.VideoQuality
|
||||
}
|
||||
OnTrackMutedStub func(livekit.ParticipantID, *livekit.TrackInfo)
|
||||
onTrackMutedMutex sync.RWMutex
|
||||
onTrackMutedArgsForCall []struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 *livekit.TrackInfo
|
||||
}
|
||||
OnTrackPublishRTPStatsStub func(livekit.ParticipantID, livekit.TrackID, mime.MimeType, int, *livekit.RTPStats)
|
||||
onTrackPublishRTPStatsMutex sync.RWMutex
|
||||
onTrackPublishRTPStatsArgsForCall []struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 livekit.TrackID
|
||||
arg3 mime.MimeType
|
||||
arg4 int
|
||||
arg5 *livekit.RTPStats
|
||||
}
|
||||
OnTrackPublishRequestedStub func(livekit.ParticipantID, livekit.ParticipantIdentity, *livekit.TrackInfo)
|
||||
onTrackPublishRequestedMutex sync.RWMutex
|
||||
onTrackPublishRequestedArgsForCall []struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 livekit.ParticipantIdentity
|
||||
arg3 *livekit.TrackInfo
|
||||
}
|
||||
OnTrackPublishedStub func(livekit.ParticipantID, livekit.ParticipantIdentity, *livekit.TrackInfo, bool)
|
||||
onTrackPublishedMutex sync.RWMutex
|
||||
onTrackPublishedArgsForCall []struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 livekit.ParticipantIdentity
|
||||
arg3 *livekit.TrackInfo
|
||||
arg4 bool
|
||||
}
|
||||
OnTrackPublishedUpdateStub func(livekit.ParticipantID, *livekit.TrackInfo)
|
||||
onTrackPublishedUpdateMutex sync.RWMutex
|
||||
onTrackPublishedUpdateArgsForCall []struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 *livekit.TrackInfo
|
||||
}
|
||||
OnTrackStatsStub func(telemetry.StatsKey, *livekit.AnalyticsStat)
|
||||
onTrackStatsMutex sync.RWMutex
|
||||
onTrackStatsArgsForCall []struct {
|
||||
arg1 telemetry.StatsKey
|
||||
arg2 *livekit.AnalyticsStat
|
||||
}
|
||||
OnTrackSubscribeFailedStub func(livekit.ParticipantID, livekit.TrackID, error, bool)
|
||||
onTrackSubscribeFailedMutex sync.RWMutex
|
||||
onTrackSubscribeFailedArgsForCall []struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 livekit.TrackID
|
||||
arg3 error
|
||||
arg4 bool
|
||||
}
|
||||
OnTrackSubscribeRTPStatsStub func(livekit.ParticipantID, livekit.TrackID, mime.MimeType, *livekit.RTPStats)
|
||||
onTrackSubscribeRTPStatsMutex sync.RWMutex
|
||||
onTrackSubscribeRTPStatsArgsForCall []struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 livekit.TrackID
|
||||
arg3 mime.MimeType
|
||||
arg4 *livekit.RTPStats
|
||||
}
|
||||
OnTrackSubscribeRequestedStub func(livekit.ParticipantID, *livekit.TrackInfo)
|
||||
onTrackSubscribeRequestedMutex sync.RWMutex
|
||||
onTrackSubscribeRequestedArgsForCall []struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 *livekit.TrackInfo
|
||||
}
|
||||
OnTrackSubscribedStub func(livekit.ParticipantID, *livekit.TrackInfo, *livekit.ParticipantInfo, bool)
|
||||
onTrackSubscribedMutex sync.RWMutex
|
||||
onTrackSubscribedArgsForCall []struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 *livekit.TrackInfo
|
||||
arg3 *livekit.ParticipantInfo
|
||||
arg4 bool
|
||||
}
|
||||
OnTrackUnmutedStub func(livekit.ParticipantID, *livekit.TrackInfo)
|
||||
onTrackUnmutedMutex sync.RWMutex
|
||||
onTrackUnmutedArgsForCall []struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 *livekit.TrackInfo
|
||||
}
|
||||
OnTrackUnpublishedStub func(livekit.ParticipantID, livekit.ParticipantIdentity, *livekit.TrackInfo, bool)
|
||||
onTrackUnpublishedMutex sync.RWMutex
|
||||
onTrackUnpublishedArgsForCall []struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 livekit.ParticipantIdentity
|
||||
arg3 *livekit.TrackInfo
|
||||
arg4 bool
|
||||
}
|
||||
OnTrackUnsubscribedStub func(livekit.ParticipantID, *livekit.TrackInfo, bool)
|
||||
onTrackUnsubscribedMutex sync.RWMutex
|
||||
onTrackUnsubscribedArgsForCall []struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 *livekit.TrackInfo
|
||||
arg3 bool
|
||||
}
|
||||
invocations map[string][][]interface{}
|
||||
invocationsMutex sync.RWMutex
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackMaxSubscribedVideoQuality(arg1 livekit.ParticipantID, arg2 *livekit.TrackInfo, arg3 mime.MimeType, arg4 livekit.VideoQuality) {
|
||||
fake.onTrackMaxSubscribedVideoQualityMutex.Lock()
|
||||
fake.onTrackMaxSubscribedVideoQualityArgsForCall = append(fake.onTrackMaxSubscribedVideoQualityArgsForCall, struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 *livekit.TrackInfo
|
||||
arg3 mime.MimeType
|
||||
arg4 livekit.VideoQuality
|
||||
}{arg1, arg2, arg3, arg4})
|
||||
stub := fake.OnTrackMaxSubscribedVideoQualityStub
|
||||
fake.recordInvocation("OnTrackMaxSubscribedVideoQuality", []interface{}{arg1, arg2, arg3, arg4})
|
||||
fake.onTrackMaxSubscribedVideoQualityMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.OnTrackMaxSubscribedVideoQualityStub(arg1, arg2, arg3, arg4)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackMaxSubscribedVideoQualityCallCount() int {
|
||||
fake.onTrackMaxSubscribedVideoQualityMutex.RLock()
|
||||
defer fake.onTrackMaxSubscribedVideoQualityMutex.RUnlock()
|
||||
return len(fake.onTrackMaxSubscribedVideoQualityArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackMaxSubscribedVideoQualityCalls(stub func(livekit.ParticipantID, *livekit.TrackInfo, mime.MimeType, livekit.VideoQuality)) {
|
||||
fake.onTrackMaxSubscribedVideoQualityMutex.Lock()
|
||||
defer fake.onTrackMaxSubscribedVideoQualityMutex.Unlock()
|
||||
fake.OnTrackMaxSubscribedVideoQualityStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackMaxSubscribedVideoQualityArgsForCall(i int) (livekit.ParticipantID, *livekit.TrackInfo, mime.MimeType, livekit.VideoQuality) {
|
||||
fake.onTrackMaxSubscribedVideoQualityMutex.RLock()
|
||||
defer fake.onTrackMaxSubscribedVideoQualityMutex.RUnlock()
|
||||
argsForCall := fake.onTrackMaxSubscribedVideoQualityArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackMuted(arg1 livekit.ParticipantID, arg2 *livekit.TrackInfo) {
|
||||
fake.onTrackMutedMutex.Lock()
|
||||
fake.onTrackMutedArgsForCall = append(fake.onTrackMutedArgsForCall, struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 *livekit.TrackInfo
|
||||
}{arg1, arg2})
|
||||
stub := fake.OnTrackMutedStub
|
||||
fake.recordInvocation("OnTrackMuted", []interface{}{arg1, arg2})
|
||||
fake.onTrackMutedMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.OnTrackMutedStub(arg1, arg2)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackMutedCallCount() int {
|
||||
fake.onTrackMutedMutex.RLock()
|
||||
defer fake.onTrackMutedMutex.RUnlock()
|
||||
return len(fake.onTrackMutedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackMutedCalls(stub func(livekit.ParticipantID, *livekit.TrackInfo)) {
|
||||
fake.onTrackMutedMutex.Lock()
|
||||
defer fake.onTrackMutedMutex.Unlock()
|
||||
fake.OnTrackMutedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackMutedArgsForCall(i int) (livekit.ParticipantID, *livekit.TrackInfo) {
|
||||
fake.onTrackMutedMutex.RLock()
|
||||
defer fake.onTrackMutedMutex.RUnlock()
|
||||
argsForCall := fake.onTrackMutedArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackPublishRTPStats(arg1 livekit.ParticipantID, arg2 livekit.TrackID, arg3 mime.MimeType, arg4 int, arg5 *livekit.RTPStats) {
|
||||
fake.onTrackPublishRTPStatsMutex.Lock()
|
||||
fake.onTrackPublishRTPStatsArgsForCall = append(fake.onTrackPublishRTPStatsArgsForCall, struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 livekit.TrackID
|
||||
arg3 mime.MimeType
|
||||
arg4 int
|
||||
arg5 *livekit.RTPStats
|
||||
}{arg1, arg2, arg3, arg4, arg5})
|
||||
stub := fake.OnTrackPublishRTPStatsStub
|
||||
fake.recordInvocation("OnTrackPublishRTPStats", []interface{}{arg1, arg2, arg3, arg4, arg5})
|
||||
fake.onTrackPublishRTPStatsMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.OnTrackPublishRTPStatsStub(arg1, arg2, arg3, arg4, arg5)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackPublishRTPStatsCallCount() int {
|
||||
fake.onTrackPublishRTPStatsMutex.RLock()
|
||||
defer fake.onTrackPublishRTPStatsMutex.RUnlock()
|
||||
return len(fake.onTrackPublishRTPStatsArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackPublishRTPStatsCalls(stub func(livekit.ParticipantID, livekit.TrackID, mime.MimeType, int, *livekit.RTPStats)) {
|
||||
fake.onTrackPublishRTPStatsMutex.Lock()
|
||||
defer fake.onTrackPublishRTPStatsMutex.Unlock()
|
||||
fake.OnTrackPublishRTPStatsStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackPublishRTPStatsArgsForCall(i int) (livekit.ParticipantID, livekit.TrackID, mime.MimeType, int, *livekit.RTPStats) {
|
||||
fake.onTrackPublishRTPStatsMutex.RLock()
|
||||
defer fake.onTrackPublishRTPStatsMutex.RUnlock()
|
||||
argsForCall := fake.onTrackPublishRTPStatsArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackPublishRequested(arg1 livekit.ParticipantID, arg2 livekit.ParticipantIdentity, arg3 *livekit.TrackInfo) {
|
||||
fake.onTrackPublishRequestedMutex.Lock()
|
||||
fake.onTrackPublishRequestedArgsForCall = append(fake.onTrackPublishRequestedArgsForCall, struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 livekit.ParticipantIdentity
|
||||
arg3 *livekit.TrackInfo
|
||||
}{arg1, arg2, arg3})
|
||||
stub := fake.OnTrackPublishRequestedStub
|
||||
fake.recordInvocation("OnTrackPublishRequested", []interface{}{arg1, arg2, arg3})
|
||||
fake.onTrackPublishRequestedMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.OnTrackPublishRequestedStub(arg1, arg2, arg3)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackPublishRequestedCallCount() int {
|
||||
fake.onTrackPublishRequestedMutex.RLock()
|
||||
defer fake.onTrackPublishRequestedMutex.RUnlock()
|
||||
return len(fake.onTrackPublishRequestedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackPublishRequestedCalls(stub func(livekit.ParticipantID, livekit.ParticipantIdentity, *livekit.TrackInfo)) {
|
||||
fake.onTrackPublishRequestedMutex.Lock()
|
||||
defer fake.onTrackPublishRequestedMutex.Unlock()
|
||||
fake.OnTrackPublishRequestedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackPublishRequestedArgsForCall(i int) (livekit.ParticipantID, livekit.ParticipantIdentity, *livekit.TrackInfo) {
|
||||
fake.onTrackPublishRequestedMutex.RLock()
|
||||
defer fake.onTrackPublishRequestedMutex.RUnlock()
|
||||
argsForCall := fake.onTrackPublishRequestedArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackPublished(arg1 livekit.ParticipantID, arg2 livekit.ParticipantIdentity, arg3 *livekit.TrackInfo, arg4 bool) {
|
||||
fake.onTrackPublishedMutex.Lock()
|
||||
fake.onTrackPublishedArgsForCall = append(fake.onTrackPublishedArgsForCall, struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 livekit.ParticipantIdentity
|
||||
arg3 *livekit.TrackInfo
|
||||
arg4 bool
|
||||
}{arg1, arg2, arg3, arg4})
|
||||
stub := fake.OnTrackPublishedStub
|
||||
fake.recordInvocation("OnTrackPublished", []interface{}{arg1, arg2, arg3, arg4})
|
||||
fake.onTrackPublishedMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.OnTrackPublishedStub(arg1, arg2, arg3, arg4)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackPublishedCallCount() int {
|
||||
fake.onTrackPublishedMutex.RLock()
|
||||
defer fake.onTrackPublishedMutex.RUnlock()
|
||||
return len(fake.onTrackPublishedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackPublishedCalls(stub func(livekit.ParticipantID, livekit.ParticipantIdentity, *livekit.TrackInfo, bool)) {
|
||||
fake.onTrackPublishedMutex.Lock()
|
||||
defer fake.onTrackPublishedMutex.Unlock()
|
||||
fake.OnTrackPublishedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackPublishedArgsForCall(i int) (livekit.ParticipantID, livekit.ParticipantIdentity, *livekit.TrackInfo, bool) {
|
||||
fake.onTrackPublishedMutex.RLock()
|
||||
defer fake.onTrackPublishedMutex.RUnlock()
|
||||
argsForCall := fake.onTrackPublishedArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackPublishedUpdate(arg1 livekit.ParticipantID, arg2 *livekit.TrackInfo) {
|
||||
fake.onTrackPublishedUpdateMutex.Lock()
|
||||
fake.onTrackPublishedUpdateArgsForCall = append(fake.onTrackPublishedUpdateArgsForCall, struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 *livekit.TrackInfo
|
||||
}{arg1, arg2})
|
||||
stub := fake.OnTrackPublishedUpdateStub
|
||||
fake.recordInvocation("OnTrackPublishedUpdate", []interface{}{arg1, arg2})
|
||||
fake.onTrackPublishedUpdateMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.OnTrackPublishedUpdateStub(arg1, arg2)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackPublishedUpdateCallCount() int {
|
||||
fake.onTrackPublishedUpdateMutex.RLock()
|
||||
defer fake.onTrackPublishedUpdateMutex.RUnlock()
|
||||
return len(fake.onTrackPublishedUpdateArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackPublishedUpdateCalls(stub func(livekit.ParticipantID, *livekit.TrackInfo)) {
|
||||
fake.onTrackPublishedUpdateMutex.Lock()
|
||||
defer fake.onTrackPublishedUpdateMutex.Unlock()
|
||||
fake.OnTrackPublishedUpdateStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackPublishedUpdateArgsForCall(i int) (livekit.ParticipantID, *livekit.TrackInfo) {
|
||||
fake.onTrackPublishedUpdateMutex.RLock()
|
||||
defer fake.onTrackPublishedUpdateMutex.RUnlock()
|
||||
argsForCall := fake.onTrackPublishedUpdateArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackStats(arg1 telemetry.StatsKey, arg2 *livekit.AnalyticsStat) {
|
||||
fake.onTrackStatsMutex.Lock()
|
||||
fake.onTrackStatsArgsForCall = append(fake.onTrackStatsArgsForCall, struct {
|
||||
arg1 telemetry.StatsKey
|
||||
arg2 *livekit.AnalyticsStat
|
||||
}{arg1, arg2})
|
||||
stub := fake.OnTrackStatsStub
|
||||
fake.recordInvocation("OnTrackStats", []interface{}{arg1, arg2})
|
||||
fake.onTrackStatsMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.OnTrackStatsStub(arg1, arg2)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackStatsCallCount() int {
|
||||
fake.onTrackStatsMutex.RLock()
|
||||
defer fake.onTrackStatsMutex.RUnlock()
|
||||
return len(fake.onTrackStatsArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackStatsCalls(stub func(telemetry.StatsKey, *livekit.AnalyticsStat)) {
|
||||
fake.onTrackStatsMutex.Lock()
|
||||
defer fake.onTrackStatsMutex.Unlock()
|
||||
fake.OnTrackStatsStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackStatsArgsForCall(i int) (telemetry.StatsKey, *livekit.AnalyticsStat) {
|
||||
fake.onTrackStatsMutex.RLock()
|
||||
defer fake.onTrackStatsMutex.RUnlock()
|
||||
argsForCall := fake.onTrackStatsArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackSubscribeFailed(arg1 livekit.ParticipantID, arg2 livekit.TrackID, arg3 error, arg4 bool) {
|
||||
fake.onTrackSubscribeFailedMutex.Lock()
|
||||
fake.onTrackSubscribeFailedArgsForCall = append(fake.onTrackSubscribeFailedArgsForCall, struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 livekit.TrackID
|
||||
arg3 error
|
||||
arg4 bool
|
||||
}{arg1, arg2, arg3, arg4})
|
||||
stub := fake.OnTrackSubscribeFailedStub
|
||||
fake.recordInvocation("OnTrackSubscribeFailed", []interface{}{arg1, arg2, arg3, arg4})
|
||||
fake.onTrackSubscribeFailedMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.OnTrackSubscribeFailedStub(arg1, arg2, arg3, arg4)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackSubscribeFailedCallCount() int {
|
||||
fake.onTrackSubscribeFailedMutex.RLock()
|
||||
defer fake.onTrackSubscribeFailedMutex.RUnlock()
|
||||
return len(fake.onTrackSubscribeFailedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackSubscribeFailedCalls(stub func(livekit.ParticipantID, livekit.TrackID, error, bool)) {
|
||||
fake.onTrackSubscribeFailedMutex.Lock()
|
||||
defer fake.onTrackSubscribeFailedMutex.Unlock()
|
||||
fake.OnTrackSubscribeFailedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackSubscribeFailedArgsForCall(i int) (livekit.ParticipantID, livekit.TrackID, error, bool) {
|
||||
fake.onTrackSubscribeFailedMutex.RLock()
|
||||
defer fake.onTrackSubscribeFailedMutex.RUnlock()
|
||||
argsForCall := fake.onTrackSubscribeFailedArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackSubscribeRTPStats(arg1 livekit.ParticipantID, arg2 livekit.TrackID, arg3 mime.MimeType, arg4 *livekit.RTPStats) {
|
||||
fake.onTrackSubscribeRTPStatsMutex.Lock()
|
||||
fake.onTrackSubscribeRTPStatsArgsForCall = append(fake.onTrackSubscribeRTPStatsArgsForCall, struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 livekit.TrackID
|
||||
arg3 mime.MimeType
|
||||
arg4 *livekit.RTPStats
|
||||
}{arg1, arg2, arg3, arg4})
|
||||
stub := fake.OnTrackSubscribeRTPStatsStub
|
||||
fake.recordInvocation("OnTrackSubscribeRTPStats", []interface{}{arg1, arg2, arg3, arg4})
|
||||
fake.onTrackSubscribeRTPStatsMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.OnTrackSubscribeRTPStatsStub(arg1, arg2, arg3, arg4)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackSubscribeRTPStatsCallCount() int {
|
||||
fake.onTrackSubscribeRTPStatsMutex.RLock()
|
||||
defer fake.onTrackSubscribeRTPStatsMutex.RUnlock()
|
||||
return len(fake.onTrackSubscribeRTPStatsArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackSubscribeRTPStatsCalls(stub func(livekit.ParticipantID, livekit.TrackID, mime.MimeType, *livekit.RTPStats)) {
|
||||
fake.onTrackSubscribeRTPStatsMutex.Lock()
|
||||
defer fake.onTrackSubscribeRTPStatsMutex.Unlock()
|
||||
fake.OnTrackSubscribeRTPStatsStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackSubscribeRTPStatsArgsForCall(i int) (livekit.ParticipantID, livekit.TrackID, mime.MimeType, *livekit.RTPStats) {
|
||||
fake.onTrackSubscribeRTPStatsMutex.RLock()
|
||||
defer fake.onTrackSubscribeRTPStatsMutex.RUnlock()
|
||||
argsForCall := fake.onTrackSubscribeRTPStatsArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackSubscribeRequested(arg1 livekit.ParticipantID, arg2 *livekit.TrackInfo) {
|
||||
fake.onTrackSubscribeRequestedMutex.Lock()
|
||||
fake.onTrackSubscribeRequestedArgsForCall = append(fake.onTrackSubscribeRequestedArgsForCall, struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 *livekit.TrackInfo
|
||||
}{arg1, arg2})
|
||||
stub := fake.OnTrackSubscribeRequestedStub
|
||||
fake.recordInvocation("OnTrackSubscribeRequested", []interface{}{arg1, arg2})
|
||||
fake.onTrackSubscribeRequestedMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.OnTrackSubscribeRequestedStub(arg1, arg2)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackSubscribeRequestedCallCount() int {
|
||||
fake.onTrackSubscribeRequestedMutex.RLock()
|
||||
defer fake.onTrackSubscribeRequestedMutex.RUnlock()
|
||||
return len(fake.onTrackSubscribeRequestedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackSubscribeRequestedCalls(stub func(livekit.ParticipantID, *livekit.TrackInfo)) {
|
||||
fake.onTrackSubscribeRequestedMutex.Lock()
|
||||
defer fake.onTrackSubscribeRequestedMutex.Unlock()
|
||||
fake.OnTrackSubscribeRequestedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackSubscribeRequestedArgsForCall(i int) (livekit.ParticipantID, *livekit.TrackInfo) {
|
||||
fake.onTrackSubscribeRequestedMutex.RLock()
|
||||
defer fake.onTrackSubscribeRequestedMutex.RUnlock()
|
||||
argsForCall := fake.onTrackSubscribeRequestedArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackSubscribed(arg1 livekit.ParticipantID, arg2 *livekit.TrackInfo, arg3 *livekit.ParticipantInfo, arg4 bool) {
|
||||
fake.onTrackSubscribedMutex.Lock()
|
||||
fake.onTrackSubscribedArgsForCall = append(fake.onTrackSubscribedArgsForCall, struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 *livekit.TrackInfo
|
||||
arg3 *livekit.ParticipantInfo
|
||||
arg4 bool
|
||||
}{arg1, arg2, arg3, arg4})
|
||||
stub := fake.OnTrackSubscribedStub
|
||||
fake.recordInvocation("OnTrackSubscribed", []interface{}{arg1, arg2, arg3, arg4})
|
||||
fake.onTrackSubscribedMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.OnTrackSubscribedStub(arg1, arg2, arg3, arg4)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackSubscribedCallCount() int {
|
||||
fake.onTrackSubscribedMutex.RLock()
|
||||
defer fake.onTrackSubscribedMutex.RUnlock()
|
||||
return len(fake.onTrackSubscribedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackSubscribedCalls(stub func(livekit.ParticipantID, *livekit.TrackInfo, *livekit.ParticipantInfo, bool)) {
|
||||
fake.onTrackSubscribedMutex.Lock()
|
||||
defer fake.onTrackSubscribedMutex.Unlock()
|
||||
fake.OnTrackSubscribedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackSubscribedArgsForCall(i int) (livekit.ParticipantID, *livekit.TrackInfo, *livekit.ParticipantInfo, bool) {
|
||||
fake.onTrackSubscribedMutex.RLock()
|
||||
defer fake.onTrackSubscribedMutex.RUnlock()
|
||||
argsForCall := fake.onTrackSubscribedArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackUnmuted(arg1 livekit.ParticipantID, arg2 *livekit.TrackInfo) {
|
||||
fake.onTrackUnmutedMutex.Lock()
|
||||
fake.onTrackUnmutedArgsForCall = append(fake.onTrackUnmutedArgsForCall, struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 *livekit.TrackInfo
|
||||
}{arg1, arg2})
|
||||
stub := fake.OnTrackUnmutedStub
|
||||
fake.recordInvocation("OnTrackUnmuted", []interface{}{arg1, arg2})
|
||||
fake.onTrackUnmutedMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.OnTrackUnmutedStub(arg1, arg2)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackUnmutedCallCount() int {
|
||||
fake.onTrackUnmutedMutex.RLock()
|
||||
defer fake.onTrackUnmutedMutex.RUnlock()
|
||||
return len(fake.onTrackUnmutedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackUnmutedCalls(stub func(livekit.ParticipantID, *livekit.TrackInfo)) {
|
||||
fake.onTrackUnmutedMutex.Lock()
|
||||
defer fake.onTrackUnmutedMutex.Unlock()
|
||||
fake.OnTrackUnmutedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackUnmutedArgsForCall(i int) (livekit.ParticipantID, *livekit.TrackInfo) {
|
||||
fake.onTrackUnmutedMutex.RLock()
|
||||
defer fake.onTrackUnmutedMutex.RUnlock()
|
||||
argsForCall := fake.onTrackUnmutedArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackUnpublished(arg1 livekit.ParticipantID, arg2 livekit.ParticipantIdentity, arg3 *livekit.TrackInfo, arg4 bool) {
|
||||
fake.onTrackUnpublishedMutex.Lock()
|
||||
fake.onTrackUnpublishedArgsForCall = append(fake.onTrackUnpublishedArgsForCall, struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 livekit.ParticipantIdentity
|
||||
arg3 *livekit.TrackInfo
|
||||
arg4 bool
|
||||
}{arg1, arg2, arg3, arg4})
|
||||
stub := fake.OnTrackUnpublishedStub
|
||||
fake.recordInvocation("OnTrackUnpublished", []interface{}{arg1, arg2, arg3, arg4})
|
||||
fake.onTrackUnpublishedMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.OnTrackUnpublishedStub(arg1, arg2, arg3, arg4)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackUnpublishedCallCount() int {
|
||||
fake.onTrackUnpublishedMutex.RLock()
|
||||
defer fake.onTrackUnpublishedMutex.RUnlock()
|
||||
return len(fake.onTrackUnpublishedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackUnpublishedCalls(stub func(livekit.ParticipantID, livekit.ParticipantIdentity, *livekit.TrackInfo, bool)) {
|
||||
fake.onTrackUnpublishedMutex.Lock()
|
||||
defer fake.onTrackUnpublishedMutex.Unlock()
|
||||
fake.OnTrackUnpublishedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackUnpublishedArgsForCall(i int) (livekit.ParticipantID, livekit.ParticipantIdentity, *livekit.TrackInfo, bool) {
|
||||
fake.onTrackUnpublishedMutex.RLock()
|
||||
defer fake.onTrackUnpublishedMutex.RUnlock()
|
||||
argsForCall := fake.onTrackUnpublishedArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackUnsubscribed(arg1 livekit.ParticipantID, arg2 *livekit.TrackInfo, arg3 bool) {
|
||||
fake.onTrackUnsubscribedMutex.Lock()
|
||||
fake.onTrackUnsubscribedArgsForCall = append(fake.onTrackUnsubscribedArgsForCall, struct {
|
||||
arg1 livekit.ParticipantID
|
||||
arg2 *livekit.TrackInfo
|
||||
arg3 bool
|
||||
}{arg1, arg2, arg3})
|
||||
stub := fake.OnTrackUnsubscribedStub
|
||||
fake.recordInvocation("OnTrackUnsubscribed", []interface{}{arg1, arg2, arg3})
|
||||
fake.onTrackUnsubscribedMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.OnTrackUnsubscribedStub(arg1, arg2, arg3)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackUnsubscribedCallCount() int {
|
||||
fake.onTrackUnsubscribedMutex.RLock()
|
||||
defer fake.onTrackUnsubscribedMutex.RUnlock()
|
||||
return len(fake.onTrackUnsubscribedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackUnsubscribedCalls(stub func(livekit.ParticipantID, *livekit.TrackInfo, bool)) {
|
||||
fake.onTrackUnsubscribedMutex.Lock()
|
||||
defer fake.onTrackUnsubscribedMutex.Unlock()
|
||||
fake.OnTrackUnsubscribedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) OnTrackUnsubscribedArgsForCall(i int) (livekit.ParticipantID, *livekit.TrackInfo, bool) {
|
||||
fake.onTrackUnsubscribedMutex.RLock()
|
||||
defer fake.onTrackUnsubscribedMutex.RUnlock()
|
||||
argsForCall := fake.onTrackUnsubscribedArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) Invocations() map[string][][]interface{} {
|
||||
fake.invocationsMutex.RLock()
|
||||
defer fake.invocationsMutex.RUnlock()
|
||||
copiedInvocations := map[string][][]interface{}{}
|
||||
for key, value := range fake.invocations {
|
||||
copiedInvocations[key] = value
|
||||
}
|
||||
return copiedInvocations
|
||||
}
|
||||
|
||||
func (fake *FakeParticipantTelemetryListener) recordInvocation(key string, args []interface{}) {
|
||||
fake.invocationsMutex.Lock()
|
||||
defer fake.invocationsMutex.Unlock()
|
||||
if fake.invocations == nil {
|
||||
fake.invocations = map[string][][]interface{}{}
|
||||
}
|
||||
if fake.invocations[key] == nil {
|
||||
fake.invocations[key] = [][]interface{}{}
|
||||
}
|
||||
fake.invocations[key] = append(fake.invocations[key], args)
|
||||
}
|
||||
|
||||
var _ types.ParticipantTelemetryListener = new(FakeParticipantTelemetryListener)
|
||||
Reference in New Issue
Block a user