Added track success & muted events (#1308)
Related to livekit/protocol#273 This PR adds: - ParticipantResumed - for when ICE restart or migration had occurred - TrackPublishRequested - when we initiate a publication - TrackSubscribeRequested - when we initiate a subscription - TrackMuted - publisher muted track - TrackUnmuted - publisher unmuted track - TrackPublish/TrackSubcribe events will indicate when those actions have been successful, to differentiate.
This commit is contained in:
+168
-127
@@ -80,16 +80,10 @@ func (t *telemetryService) ParticipantJoined(
|
||||
)
|
||||
|
||||
if shouldSendEvent {
|
||||
t.SendEvent(ctx, &livekit.AnalyticsEvent{
|
||||
Type: livekit.AnalyticsEventType_PARTICIPANT_JOINED,
|
||||
Timestamp: timestamppb.Now(),
|
||||
RoomId: room.Sid,
|
||||
ParticipantId: participant.Sid,
|
||||
Participant: participant,
|
||||
Room: room,
|
||||
ClientInfo: clientInfo,
|
||||
ClientMeta: clientMeta,
|
||||
})
|
||||
ev := newParticipantEvent(livekit.AnalyticsEventType_PARTICIPANT_JOINED, room, participant)
|
||||
ev.ClientInfo = clientInfo
|
||||
ev.ClientMeta = clientMeta
|
||||
t.SendEvent(ctx, ev)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -125,15 +119,24 @@ func (t *telemetryService) ParticipantActive(
|
||||
}
|
||||
worker.SetConnected()
|
||||
|
||||
t.SendEvent(ctx, &livekit.AnalyticsEvent{
|
||||
Type: livekit.AnalyticsEventType_PARTICIPANT_ACTIVE,
|
||||
Timestamp: timestamppb.Now(),
|
||||
RoomId: room.Sid,
|
||||
ParticipantId: participant.Sid,
|
||||
Participant: participant,
|
||||
Room: room,
|
||||
ClientMeta: clientMeta,
|
||||
})
|
||||
ev := newParticipantEvent(livekit.AnalyticsEventType_PARTICIPANT_ACTIVE, room, participant)
|
||||
ev.ClientMeta = clientMeta
|
||||
t.SendEvent(ctx, ev)
|
||||
})
|
||||
}
|
||||
|
||||
func (t *telemetryService) ParticipantResumed(
|
||||
ctx context.Context,
|
||||
room *livekit.Room,
|
||||
participant *livekit.ParticipantInfo,
|
||||
nodeID livekit.NodeID,
|
||||
) {
|
||||
t.enqueue(func() {
|
||||
ev := newParticipantEvent(livekit.AnalyticsEventType_PARTICIPANT_RESUMED, room, participant)
|
||||
ev.ClientMeta = &livekit.AnalyticsClientMeta{
|
||||
Node: string(nodeID),
|
||||
}
|
||||
t.SendEvent(ctx, ev)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -163,18 +166,28 @@ func (t *telemetryService) ParticipantLeft(ctx context.Context,
|
||||
Participant: participant,
|
||||
})
|
||||
|
||||
t.SendEvent(ctx, &livekit.AnalyticsEvent{
|
||||
Type: livekit.AnalyticsEventType_PARTICIPANT_LEFT,
|
||||
Timestamp: timestamppb.Now(),
|
||||
RoomId: room.Sid,
|
||||
ParticipantId: participant.Sid,
|
||||
Participant: participant,
|
||||
Room: room,
|
||||
})
|
||||
t.SendEvent(ctx, newParticipantEvent(livekit.AnalyticsEventType_PARTICIPANT_LEFT, room, participant))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (t *telemetryService) TrackPublishRequested(
|
||||
ctx context.Context,
|
||||
participantID livekit.ParticipantID,
|
||||
identity livekit.ParticipantIdentity,
|
||||
track *livekit.TrackInfo,
|
||||
) {
|
||||
t.enqueue(func() {
|
||||
prometheus.AddPublishAttempt(track.Type.String())
|
||||
room := t.getRoomDetails(participantID)
|
||||
ev := newTrackEvent(livekit.AnalyticsEventType_TRACK_PUBLISH_REQUESTED, room, participantID, track)
|
||||
if ev.Participant != nil {
|
||||
ev.Participant.Identity = string(identity)
|
||||
}
|
||||
t.SendEvent(ctx, ev)
|
||||
})
|
||||
}
|
||||
|
||||
func (t *telemetryService) TrackPublished(
|
||||
ctx context.Context,
|
||||
participantID livekit.ParticipantID,
|
||||
@@ -183,47 +196,30 @@ func (t *telemetryService) TrackPublished(
|
||||
) {
|
||||
t.enqueue(func() {
|
||||
prometheus.AddPublishedTrack(track.Type.String())
|
||||
prometheus.AddPublishSuccess(track.Type.String())
|
||||
|
||||
roomID, roomName := t.getRoomDetails(participantID)
|
||||
room := t.getRoomDetails(participantID)
|
||||
participant := &livekit.ParticipantInfo{
|
||||
Sid: string(participantID),
|
||||
Identity: string(identity),
|
||||
}
|
||||
t.NotifyEvent(ctx, &livekit.WebhookEvent{
|
||||
Event: webhook.EventTrackPublished,
|
||||
Room: &livekit.Room{
|
||||
Sid: string(roomID),
|
||||
Name: string(roomName),
|
||||
},
|
||||
Participant: &livekit.ParticipantInfo{
|
||||
Sid: string(participantID),
|
||||
Identity: string(identity),
|
||||
},
|
||||
Track: track,
|
||||
Event: webhook.EventTrackPublished,
|
||||
Room: room,
|
||||
Participant: participant,
|
||||
Track: track,
|
||||
})
|
||||
|
||||
t.SendEvent(ctx, &livekit.AnalyticsEvent{
|
||||
Type: livekit.AnalyticsEventType_TRACK_PUBLISHED,
|
||||
Timestamp: timestamppb.Now(),
|
||||
RoomId: string(roomID),
|
||||
ParticipantId: string(participantID),
|
||||
Participant: &livekit.ParticipantInfo{
|
||||
Sid: string(participantID),
|
||||
Identity: string(identity),
|
||||
},
|
||||
Track: track,
|
||||
Room: &livekit.Room{Name: string(roomName)},
|
||||
})
|
||||
ev := newTrackEvent(livekit.AnalyticsEventType_TRACK_PUBLISHED, room, participantID, track)
|
||||
ev.Participant = participant
|
||||
t.SendEvent(ctx, ev)
|
||||
})
|
||||
}
|
||||
|
||||
func (t *telemetryService) TrackPublishedUpdate(ctx context.Context, participantID livekit.ParticipantID, track *livekit.TrackInfo) {
|
||||
t.enqueue(func() {
|
||||
roomID, roomName := t.getRoomDetails(participantID)
|
||||
t.SendEvent(ctx, &livekit.AnalyticsEvent{
|
||||
Type: livekit.AnalyticsEventType_TRACK_PUBLISHED_UPDATE,
|
||||
Timestamp: timestamppb.Now(),
|
||||
RoomId: string(roomID),
|
||||
ParticipantId: string(participantID),
|
||||
Track: track,
|
||||
Room: &livekit.Room{Name: string(roomName)},
|
||||
})
|
||||
room := t.getRoomDetails(participantID)
|
||||
t.SendEvent(ctx, newTrackEvent(livekit.AnalyticsEventType_TRACK_PUBLISHED_UPDATE, room, participantID, track))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -235,17 +231,25 @@ func (t *telemetryService) TrackMaxSubscribedVideoQuality(
|
||||
maxQuality livekit.VideoQuality,
|
||||
) {
|
||||
t.enqueue(func() {
|
||||
roomID, roomName := t.getRoomDetails(participantID)
|
||||
t.SendEvent(ctx, &livekit.AnalyticsEvent{
|
||||
Type: livekit.AnalyticsEventType_TRACK_MAX_SUBSCRIBED_VIDEO_QUALITY,
|
||||
Timestamp: timestamppb.Now(),
|
||||
RoomId: string(roomID),
|
||||
ParticipantId: string(participantID),
|
||||
Track: track,
|
||||
Room: &livekit.Room{Name: string(roomName)},
|
||||
MaxSubscribedVideoQuality: maxQuality,
|
||||
Mime: mime,
|
||||
})
|
||||
room := t.getRoomDetails(participantID)
|
||||
ev := newTrackEvent(livekit.AnalyticsEventType_TRACK_MAX_SUBSCRIBED_VIDEO_QUALITY, room, participantID, track)
|
||||
ev.MaxSubscribedVideoQuality = maxQuality
|
||||
ev.Mime = mime
|
||||
t.SendEvent(ctx, ev)
|
||||
})
|
||||
}
|
||||
|
||||
func (t *telemetryService) TrackSubscribeRequested(
|
||||
ctx context.Context,
|
||||
participantID livekit.ParticipantID,
|
||||
track *livekit.TrackInfo,
|
||||
publisher *livekit.ParticipantInfo,
|
||||
) {
|
||||
t.enqueue(func() {
|
||||
room := t.getRoomDetails(participantID)
|
||||
ev := newTrackEvent(livekit.AnalyticsEventType_TRACK_SUBSCRIBE_REQUESTED, room, participantID, track)
|
||||
ev.Publisher = publisher
|
||||
t.SendEvent(ctx, ev)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -258,16 +262,10 @@ func (t *telemetryService) TrackSubscribed(
|
||||
t.enqueue(func() {
|
||||
prometheus.AddSubscribedTrack(track.Type.String())
|
||||
|
||||
roomID, roomName := t.getRoomDetails(participantID)
|
||||
t.SendEvent(ctx, &livekit.AnalyticsEvent{
|
||||
Type: livekit.AnalyticsEventType_TRACK_SUBSCRIBED,
|
||||
Timestamp: timestamppb.Now(),
|
||||
RoomId: string(roomID),
|
||||
ParticipantId: string(participantID),
|
||||
Track: track,
|
||||
Room: &livekit.Room{Name: string(roomName)},
|
||||
Publisher: publisher,
|
||||
})
|
||||
room := t.getRoomDetails(participantID)
|
||||
ev := newTrackEvent(livekit.AnalyticsEventType_TRACK_SUBSCRIBED, room, participantID, track)
|
||||
ev.Publisher = publisher
|
||||
t.SendEvent(ctx, ev)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -275,15 +273,8 @@ func (t *telemetryService) TrackUnsubscribed(ctx context.Context, participantID
|
||||
t.enqueue(func() {
|
||||
prometheus.SubSubscribedTrack(track.Type.String())
|
||||
|
||||
roomID, roomName := t.getRoomDetails(participantID)
|
||||
t.SendEvent(ctx, &livekit.AnalyticsEvent{
|
||||
Type: livekit.AnalyticsEventType_TRACK_UNSUBSCRIBED,
|
||||
Timestamp: timestamppb.Now(),
|
||||
RoomId: string(roomID),
|
||||
ParticipantId: string(participantID),
|
||||
TrackId: track.Sid,
|
||||
Room: &livekit.Room{Name: string(roomName)},
|
||||
})
|
||||
room := t.getRoomDetails(participantID)
|
||||
t.SendEvent(ctx, newTrackEvent(livekit.AnalyticsEventType_TRACK_UNSUBSCRIBED, room, participantID, track))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -292,34 +283,49 @@ func (t *telemetryService) TrackUnpublished(
|
||||
participantID livekit.ParticipantID,
|
||||
identity livekit.ParticipantIdentity,
|
||||
track *livekit.TrackInfo,
|
||||
ssrc uint32,
|
||||
shouldSendEvent bool,
|
||||
) {
|
||||
t.enqueue(func() {
|
||||
roomID, roomName := t.getRoomDetails(participantID)
|
||||
|
||||
prometheus.SubPublishedTrack(track.Type.String())
|
||||
if !shouldSendEvent {
|
||||
return
|
||||
}
|
||||
|
||||
room := t.getRoomDetails(participantID)
|
||||
participant := &livekit.ParticipantInfo{
|
||||
Sid: string(participantID),
|
||||
Identity: string(identity),
|
||||
}
|
||||
t.NotifyEvent(ctx, &livekit.WebhookEvent{
|
||||
Event: webhook.EventTrackUnpublished,
|
||||
Room: &livekit.Room{
|
||||
Sid: string(roomID),
|
||||
Name: string(roomName),
|
||||
},
|
||||
Participant: &livekit.ParticipantInfo{
|
||||
Sid: string(participantID),
|
||||
Identity: string(identity),
|
||||
},
|
||||
Track: track,
|
||||
Event: webhook.EventTrackUnpublished,
|
||||
Room: room,
|
||||
Participant: participant,
|
||||
Track: track,
|
||||
})
|
||||
|
||||
t.SendEvent(ctx, &livekit.AnalyticsEvent{
|
||||
Type: livekit.AnalyticsEventType_TRACK_UNPUBLISHED,
|
||||
Timestamp: timestamppb.Now(),
|
||||
RoomId: string(roomID),
|
||||
ParticipantId: string(participantID),
|
||||
TrackId: track.Sid,
|
||||
Room: &livekit.Room{Name: string(roomName)},
|
||||
})
|
||||
t.SendEvent(ctx, newTrackEvent(livekit.AnalyticsEventType_TRACK_UNPUBLISHED, room, participantID, track))
|
||||
})
|
||||
}
|
||||
|
||||
func (t *telemetryService) TrackMuted(
|
||||
ctx context.Context,
|
||||
participantID livekit.ParticipantID,
|
||||
track *livekit.TrackInfo,
|
||||
) {
|
||||
t.enqueue(func() {
|
||||
room := t.getRoomDetails(participantID)
|
||||
t.SendEvent(ctx, newTrackEvent(livekit.AnalyticsEventType_TRACK_MUTED, room, participantID, track))
|
||||
})
|
||||
}
|
||||
|
||||
func (t *telemetryService) TrackUnmuted(
|
||||
ctx context.Context,
|
||||
participantID livekit.ParticipantID,
|
||||
track *livekit.TrackInfo,
|
||||
) {
|
||||
t.enqueue(func() {
|
||||
room := t.getRoomDetails(participantID)
|
||||
t.SendEvent(ctx, newTrackEvent(livekit.AnalyticsEventType_TRACK_UNMUTED, room, participantID, track))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -330,13 +336,7 @@ func (t *telemetryService) EgressStarted(ctx context.Context, info *livekit.Egre
|
||||
EgressInfo: info,
|
||||
})
|
||||
|
||||
t.SendEvent(ctx, &livekit.AnalyticsEvent{
|
||||
Type: livekit.AnalyticsEventType_EGRESS_STARTED,
|
||||
Timestamp: timestamppb.Now(),
|
||||
EgressId: info.EgressId,
|
||||
RoomId: info.RoomId,
|
||||
Egress: info,
|
||||
})
|
||||
t.SendEvent(ctx, newEgressEvent(livekit.AnalyticsEventType_EGRESS_STARTED, info))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -347,20 +347,61 @@ func (t *telemetryService) EgressEnded(ctx context.Context, info *livekit.Egress
|
||||
EgressInfo: info,
|
||||
})
|
||||
|
||||
t.SendEvent(ctx, &livekit.AnalyticsEvent{
|
||||
Type: livekit.AnalyticsEventType_EGRESS_ENDED,
|
||||
Timestamp: timestamppb.Now(),
|
||||
EgressId: info.EgressId,
|
||||
RoomId: info.RoomId,
|
||||
Egress: info,
|
||||
})
|
||||
t.SendEvent(ctx, newEgressEvent(livekit.AnalyticsEventType_EGRESS_ENDED, info))
|
||||
})
|
||||
}
|
||||
|
||||
func (t *telemetryService) getRoomDetails(participantID livekit.ParticipantID) (livekit.RoomID, livekit.RoomName) {
|
||||
// returns a livekit.Room with only name and sid filled out
|
||||
// returns nil if room is not found
|
||||
func (t *telemetryService) getRoomDetails(participantID livekit.ParticipantID) *livekit.Room {
|
||||
if worker, ok := t.getWorker(participantID); ok {
|
||||
return worker.roomID, worker.roomName
|
||||
return &livekit.Room{
|
||||
Sid: string(worker.roomID),
|
||||
Name: string(worker.roomName),
|
||||
}
|
||||
}
|
||||
|
||||
return "", ""
|
||||
return nil
|
||||
}
|
||||
|
||||
func newRoomEvent(event livekit.AnalyticsEventType, room *livekit.Room) *livekit.AnalyticsEvent {
|
||||
ev := &livekit.AnalyticsEvent{
|
||||
Type: event,
|
||||
Timestamp: timestamppb.Now(),
|
||||
}
|
||||
if room != nil {
|
||||
ev.Room = room
|
||||
ev.RoomId = room.Sid
|
||||
}
|
||||
return ev
|
||||
}
|
||||
|
||||
func newParticipantEvent(event livekit.AnalyticsEventType, room *livekit.Room, participant *livekit.ParticipantInfo) *livekit.AnalyticsEvent {
|
||||
ev := newRoomEvent(event, room)
|
||||
if participant != nil {
|
||||
ev.ParticipantId = participant.Sid
|
||||
ev.Participant = participant
|
||||
}
|
||||
return ev
|
||||
}
|
||||
|
||||
func newTrackEvent(event livekit.AnalyticsEventType, room *livekit.Room, participantID livekit.ParticipantID, track *livekit.TrackInfo) *livekit.AnalyticsEvent {
|
||||
ev := newParticipantEvent(event, room, &livekit.ParticipantInfo{
|
||||
Sid: string(participantID),
|
||||
})
|
||||
if track != nil {
|
||||
ev.TrackId = track.Sid
|
||||
ev.Track = track
|
||||
}
|
||||
return ev
|
||||
}
|
||||
|
||||
func newEgressEvent(event livekit.AnalyticsEventType, egress *livekit.EgressInfo) *livekit.AnalyticsEvent {
|
||||
return &livekit.AnalyticsEvent{
|
||||
Type: event,
|
||||
Timestamp: timestamppb.Now(),
|
||||
EgressId: egress.EgressId,
|
||||
RoomId: egress.RoomId,
|
||||
Egress: egress,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,7 +457,7 @@ func Test_OnUpstreamRTCP_SeveralTracks(t *testing.T) {
|
||||
require.True(t, found2)
|
||||
|
||||
// remove 1 track - track stats were flushed above, so no more calls to SendStats
|
||||
fixture.sut.TrackUnpublished(context.Background(), partSID, identity, &livekit.TrackInfo{Sid: string(trackID2)}, 0)
|
||||
fixture.sut.TrackUnpublished(context.Background(), partSID, identity, &livekit.TrackInfo{Sid: string(trackID2)}, true)
|
||||
|
||||
// flush
|
||||
fixture.flush()
|
||||
|
||||
@@ -58,6 +58,14 @@ type FakeTelemetryService struct {
|
||||
arg3 *livekit.ParticipantInfo
|
||||
arg4 bool
|
||||
}
|
||||
ParticipantResumedStub func(context.Context, *livekit.Room, *livekit.ParticipantInfo, livekit.NodeID)
|
||||
participantResumedMutex sync.RWMutex
|
||||
participantResumedArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.Room
|
||||
arg3 *livekit.ParticipantInfo
|
||||
arg4 livekit.NodeID
|
||||
}
|
||||
RoomEndedStub func(context.Context, *livekit.Room)
|
||||
roomEndedMutex sync.RWMutex
|
||||
roomEndedArgsForCall []struct {
|
||||
@@ -91,6 +99,21 @@ type FakeTelemetryService struct {
|
||||
arg4 string
|
||||
arg5 livekit.VideoQuality
|
||||
}
|
||||
TrackMutedStub func(context.Context, livekit.ParticipantID, *livekit.TrackInfo)
|
||||
trackMutedMutex sync.RWMutex
|
||||
trackMutedArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 livekit.ParticipantID
|
||||
arg3 *livekit.TrackInfo
|
||||
}
|
||||
TrackPublishRequestedStub func(context.Context, livekit.ParticipantID, livekit.ParticipantIdentity, *livekit.TrackInfo)
|
||||
trackPublishRequestedMutex sync.RWMutex
|
||||
trackPublishRequestedArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 livekit.ParticipantID
|
||||
arg3 livekit.ParticipantIdentity
|
||||
arg4 *livekit.TrackInfo
|
||||
}
|
||||
TrackPublishedStub func(context.Context, livekit.ParticipantID, livekit.ParticipantIdentity, *livekit.TrackInfo)
|
||||
trackPublishedMutex sync.RWMutex
|
||||
trackPublishedArgsForCall []struct {
|
||||
@@ -114,6 +137,14 @@ type FakeTelemetryService struct {
|
||||
arg3 livekit.TrackID
|
||||
arg4 *livekit.AnalyticsStat
|
||||
}
|
||||
TrackSubscribeRequestedStub func(context.Context, livekit.ParticipantID, *livekit.TrackInfo, *livekit.ParticipantInfo)
|
||||
trackSubscribeRequestedMutex sync.RWMutex
|
||||
trackSubscribeRequestedArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 livekit.ParticipantID
|
||||
arg3 *livekit.TrackInfo
|
||||
arg4 *livekit.ParticipantInfo
|
||||
}
|
||||
TrackSubscribedStub func(context.Context, livekit.ParticipantID, *livekit.TrackInfo, *livekit.ParticipantInfo)
|
||||
trackSubscribedMutex sync.RWMutex
|
||||
trackSubscribedArgsForCall []struct {
|
||||
@@ -122,14 +153,21 @@ type FakeTelemetryService struct {
|
||||
arg3 *livekit.TrackInfo
|
||||
arg4 *livekit.ParticipantInfo
|
||||
}
|
||||
TrackUnpublishedStub func(context.Context, livekit.ParticipantID, livekit.ParticipantIdentity, *livekit.TrackInfo, uint32)
|
||||
TrackUnmutedStub func(context.Context, livekit.ParticipantID, *livekit.TrackInfo)
|
||||
trackUnmutedMutex sync.RWMutex
|
||||
trackUnmutedArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 livekit.ParticipantID
|
||||
arg3 *livekit.TrackInfo
|
||||
}
|
||||
TrackUnpublishedStub func(context.Context, livekit.ParticipantID, livekit.ParticipantIdentity, *livekit.TrackInfo, bool)
|
||||
trackUnpublishedMutex sync.RWMutex
|
||||
trackUnpublishedArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 livekit.ParticipantID
|
||||
arg3 livekit.ParticipantIdentity
|
||||
arg4 *livekit.TrackInfo
|
||||
arg5 uint32
|
||||
arg5 bool
|
||||
}
|
||||
TrackUnsubscribedStub func(context.Context, livekit.ParticipantID, *livekit.TrackInfo)
|
||||
trackUnsubscribedMutex sync.RWMutex
|
||||
@@ -372,6 +410,41 @@ func (fake *FakeTelemetryService) ParticipantLeftArgsForCall(i int) (context.Con
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) ParticipantResumed(arg1 context.Context, arg2 *livekit.Room, arg3 *livekit.ParticipantInfo, arg4 livekit.NodeID) {
|
||||
fake.participantResumedMutex.Lock()
|
||||
fake.participantResumedArgsForCall = append(fake.participantResumedArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.Room
|
||||
arg3 *livekit.ParticipantInfo
|
||||
arg4 livekit.NodeID
|
||||
}{arg1, arg2, arg3, arg4})
|
||||
stub := fake.ParticipantResumedStub
|
||||
fake.recordInvocation("ParticipantResumed", []interface{}{arg1, arg2, arg3, arg4})
|
||||
fake.participantResumedMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.ParticipantResumedStub(arg1, arg2, arg3, arg4)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) ParticipantResumedCallCount() int {
|
||||
fake.participantResumedMutex.RLock()
|
||||
defer fake.participantResumedMutex.RUnlock()
|
||||
return len(fake.participantResumedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) ParticipantResumedCalls(stub func(context.Context, *livekit.Room, *livekit.ParticipantInfo, livekit.NodeID)) {
|
||||
fake.participantResumedMutex.Lock()
|
||||
defer fake.participantResumedMutex.Unlock()
|
||||
fake.ParticipantResumedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) ParticipantResumedArgsForCall(i int) (context.Context, *livekit.Room, *livekit.ParticipantInfo, livekit.NodeID) {
|
||||
fake.participantResumedMutex.RLock()
|
||||
defer fake.participantResumedMutex.RUnlock()
|
||||
argsForCall := fake.participantResumedArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) RoomEnded(arg1 context.Context, arg2 *livekit.Room) {
|
||||
fake.roomEndedMutex.Lock()
|
||||
fake.roomEndedArgsForCall = append(fake.roomEndedArgsForCall, struct {
|
||||
@@ -545,6 +618,75 @@ func (fake *FakeTelemetryService) TrackMaxSubscribedVideoQualityArgsForCall(i in
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackMuted(arg1 context.Context, arg2 livekit.ParticipantID, arg3 *livekit.TrackInfo) {
|
||||
fake.trackMutedMutex.Lock()
|
||||
fake.trackMutedArgsForCall = append(fake.trackMutedArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 livekit.ParticipantID
|
||||
arg3 *livekit.TrackInfo
|
||||
}{arg1, arg2, arg3})
|
||||
stub := fake.TrackMutedStub
|
||||
fake.recordInvocation("TrackMuted", []interface{}{arg1, arg2, arg3})
|
||||
fake.trackMutedMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.TrackMutedStub(arg1, arg2, arg3)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackMutedCallCount() int {
|
||||
fake.trackMutedMutex.RLock()
|
||||
defer fake.trackMutedMutex.RUnlock()
|
||||
return len(fake.trackMutedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackMutedCalls(stub func(context.Context, livekit.ParticipantID, *livekit.TrackInfo)) {
|
||||
fake.trackMutedMutex.Lock()
|
||||
defer fake.trackMutedMutex.Unlock()
|
||||
fake.TrackMutedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackMutedArgsForCall(i int) (context.Context, livekit.ParticipantID, *livekit.TrackInfo) {
|
||||
fake.trackMutedMutex.RLock()
|
||||
defer fake.trackMutedMutex.RUnlock()
|
||||
argsForCall := fake.trackMutedArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackPublishRequested(arg1 context.Context, arg2 livekit.ParticipantID, arg3 livekit.ParticipantIdentity, arg4 *livekit.TrackInfo) {
|
||||
fake.trackPublishRequestedMutex.Lock()
|
||||
fake.trackPublishRequestedArgsForCall = append(fake.trackPublishRequestedArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 livekit.ParticipantID
|
||||
arg3 livekit.ParticipantIdentity
|
||||
arg4 *livekit.TrackInfo
|
||||
}{arg1, arg2, arg3, arg4})
|
||||
stub := fake.TrackPublishRequestedStub
|
||||
fake.recordInvocation("TrackPublishRequested", []interface{}{arg1, arg2, arg3, arg4})
|
||||
fake.trackPublishRequestedMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.TrackPublishRequestedStub(arg1, arg2, arg3, arg4)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackPublishRequestedCallCount() int {
|
||||
fake.trackPublishRequestedMutex.RLock()
|
||||
defer fake.trackPublishRequestedMutex.RUnlock()
|
||||
return len(fake.trackPublishRequestedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackPublishRequestedCalls(stub func(context.Context, livekit.ParticipantID, livekit.ParticipantIdentity, *livekit.TrackInfo)) {
|
||||
fake.trackPublishRequestedMutex.Lock()
|
||||
defer fake.trackPublishRequestedMutex.Unlock()
|
||||
fake.TrackPublishRequestedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackPublishRequestedArgsForCall(i int) (context.Context, livekit.ParticipantID, livekit.ParticipantIdentity, *livekit.TrackInfo) {
|
||||
fake.trackPublishRequestedMutex.RLock()
|
||||
defer fake.trackPublishRequestedMutex.RUnlock()
|
||||
argsForCall := fake.trackPublishRequestedArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackPublished(arg1 context.Context, arg2 livekit.ParticipantID, arg3 livekit.ParticipantIdentity, arg4 *livekit.TrackInfo) {
|
||||
fake.trackPublishedMutex.Lock()
|
||||
fake.trackPublishedArgsForCall = append(fake.trackPublishedArgsForCall, struct {
|
||||
@@ -649,6 +791,41 @@ func (fake *FakeTelemetryService) TrackStatsArgsForCall(i int) (livekit.StreamTy
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackSubscribeRequested(arg1 context.Context, arg2 livekit.ParticipantID, arg3 *livekit.TrackInfo, arg4 *livekit.ParticipantInfo) {
|
||||
fake.trackSubscribeRequestedMutex.Lock()
|
||||
fake.trackSubscribeRequestedArgsForCall = append(fake.trackSubscribeRequestedArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 livekit.ParticipantID
|
||||
arg3 *livekit.TrackInfo
|
||||
arg4 *livekit.ParticipantInfo
|
||||
}{arg1, arg2, arg3, arg4})
|
||||
stub := fake.TrackSubscribeRequestedStub
|
||||
fake.recordInvocation("TrackSubscribeRequested", []interface{}{arg1, arg2, arg3, arg4})
|
||||
fake.trackSubscribeRequestedMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.TrackSubscribeRequestedStub(arg1, arg2, arg3, arg4)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackSubscribeRequestedCallCount() int {
|
||||
fake.trackSubscribeRequestedMutex.RLock()
|
||||
defer fake.trackSubscribeRequestedMutex.RUnlock()
|
||||
return len(fake.trackSubscribeRequestedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackSubscribeRequestedCalls(stub func(context.Context, livekit.ParticipantID, *livekit.TrackInfo, *livekit.ParticipantInfo)) {
|
||||
fake.trackSubscribeRequestedMutex.Lock()
|
||||
defer fake.trackSubscribeRequestedMutex.Unlock()
|
||||
fake.TrackSubscribeRequestedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackSubscribeRequestedArgsForCall(i int) (context.Context, livekit.ParticipantID, *livekit.TrackInfo, *livekit.ParticipantInfo) {
|
||||
fake.trackSubscribeRequestedMutex.RLock()
|
||||
defer fake.trackSubscribeRequestedMutex.RUnlock()
|
||||
argsForCall := fake.trackSubscribeRequestedArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackSubscribed(arg1 context.Context, arg2 livekit.ParticipantID, arg3 *livekit.TrackInfo, arg4 *livekit.ParticipantInfo) {
|
||||
fake.trackSubscribedMutex.Lock()
|
||||
fake.trackSubscribedArgsForCall = append(fake.trackSubscribedArgsForCall, struct {
|
||||
@@ -684,14 +861,48 @@ func (fake *FakeTelemetryService) TrackSubscribedArgsForCall(i int) (context.Con
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackUnpublished(arg1 context.Context, arg2 livekit.ParticipantID, arg3 livekit.ParticipantIdentity, arg4 *livekit.TrackInfo, arg5 uint32) {
|
||||
func (fake *FakeTelemetryService) TrackUnmuted(arg1 context.Context, arg2 livekit.ParticipantID, arg3 *livekit.TrackInfo) {
|
||||
fake.trackUnmutedMutex.Lock()
|
||||
fake.trackUnmutedArgsForCall = append(fake.trackUnmutedArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 livekit.ParticipantID
|
||||
arg3 *livekit.TrackInfo
|
||||
}{arg1, arg2, arg3})
|
||||
stub := fake.TrackUnmutedStub
|
||||
fake.recordInvocation("TrackUnmuted", []interface{}{arg1, arg2, arg3})
|
||||
fake.trackUnmutedMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.TrackUnmutedStub(arg1, arg2, arg3)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackUnmutedCallCount() int {
|
||||
fake.trackUnmutedMutex.RLock()
|
||||
defer fake.trackUnmutedMutex.RUnlock()
|
||||
return len(fake.trackUnmutedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackUnmutedCalls(stub func(context.Context, livekit.ParticipantID, *livekit.TrackInfo)) {
|
||||
fake.trackUnmutedMutex.Lock()
|
||||
defer fake.trackUnmutedMutex.Unlock()
|
||||
fake.TrackUnmutedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackUnmutedArgsForCall(i int) (context.Context, livekit.ParticipantID, *livekit.TrackInfo) {
|
||||
fake.trackUnmutedMutex.RLock()
|
||||
defer fake.trackUnmutedMutex.RUnlock()
|
||||
argsForCall := fake.trackUnmutedArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackUnpublished(arg1 context.Context, arg2 livekit.ParticipantID, arg3 livekit.ParticipantIdentity, arg4 *livekit.TrackInfo, arg5 bool) {
|
||||
fake.trackUnpublishedMutex.Lock()
|
||||
fake.trackUnpublishedArgsForCall = append(fake.trackUnpublishedArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 livekit.ParticipantID
|
||||
arg3 livekit.ParticipantIdentity
|
||||
arg4 *livekit.TrackInfo
|
||||
arg5 uint32
|
||||
arg5 bool
|
||||
}{arg1, arg2, arg3, arg4, arg5})
|
||||
stub := fake.TrackUnpublishedStub
|
||||
fake.recordInvocation("TrackUnpublished", []interface{}{arg1, arg2, arg3, arg4, arg5})
|
||||
@@ -707,13 +918,13 @@ func (fake *FakeTelemetryService) TrackUnpublishedCallCount() int {
|
||||
return len(fake.trackUnpublishedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackUnpublishedCalls(stub func(context.Context, livekit.ParticipantID, livekit.ParticipantIdentity, *livekit.TrackInfo, uint32)) {
|
||||
func (fake *FakeTelemetryService) TrackUnpublishedCalls(stub func(context.Context, livekit.ParticipantID, livekit.ParticipantIdentity, *livekit.TrackInfo, bool)) {
|
||||
fake.trackUnpublishedMutex.Lock()
|
||||
defer fake.trackUnpublishedMutex.Unlock()
|
||||
fake.TrackUnpublishedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) TrackUnpublishedArgsForCall(i int) (context.Context, livekit.ParticipantID, livekit.ParticipantIdentity, *livekit.TrackInfo, uint32) {
|
||||
func (fake *FakeTelemetryService) TrackUnpublishedArgsForCall(i int) (context.Context, livekit.ParticipantID, livekit.ParticipantIdentity, *livekit.TrackInfo, bool) {
|
||||
fake.trackUnpublishedMutex.RLock()
|
||||
defer fake.trackUnpublishedMutex.RUnlock()
|
||||
argsForCall := fake.trackUnpublishedArgsForCall[i]
|
||||
@@ -771,6 +982,8 @@ func (fake *FakeTelemetryService) Invocations() map[string][][]interface{} {
|
||||
defer fake.participantJoinedMutex.RUnlock()
|
||||
fake.participantLeftMutex.RLock()
|
||||
defer fake.participantLeftMutex.RUnlock()
|
||||
fake.participantResumedMutex.RLock()
|
||||
defer fake.participantResumedMutex.RUnlock()
|
||||
fake.roomEndedMutex.RLock()
|
||||
defer fake.roomEndedMutex.RUnlock()
|
||||
fake.roomStartedMutex.RLock()
|
||||
@@ -781,14 +994,22 @@ func (fake *FakeTelemetryService) Invocations() map[string][][]interface{} {
|
||||
defer fake.sendStatsMutex.RUnlock()
|
||||
fake.trackMaxSubscribedVideoQualityMutex.RLock()
|
||||
defer fake.trackMaxSubscribedVideoQualityMutex.RUnlock()
|
||||
fake.trackMutedMutex.RLock()
|
||||
defer fake.trackMutedMutex.RUnlock()
|
||||
fake.trackPublishRequestedMutex.RLock()
|
||||
defer fake.trackPublishRequestedMutex.RUnlock()
|
||||
fake.trackPublishedMutex.RLock()
|
||||
defer fake.trackPublishedMutex.RUnlock()
|
||||
fake.trackPublishedUpdateMutex.RLock()
|
||||
defer fake.trackPublishedUpdateMutex.RUnlock()
|
||||
fake.trackStatsMutex.RLock()
|
||||
defer fake.trackStatsMutex.RUnlock()
|
||||
fake.trackSubscribeRequestedMutex.RLock()
|
||||
defer fake.trackSubscribeRequestedMutex.RUnlock()
|
||||
fake.trackSubscribedMutex.RLock()
|
||||
defer fake.trackSubscribedMutex.RUnlock()
|
||||
fake.trackUnmutedMutex.RLock()
|
||||
defer fake.trackUnmutedMutex.RUnlock()
|
||||
fake.trackUnpublishedMutex.RLock()
|
||||
defer fake.trackUnpublishedMutex.RUnlock()
|
||||
fake.trackUnsubscribedMutex.RLock()
|
||||
|
||||
@@ -15,20 +15,39 @@ import (
|
||||
|
||||
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . TelemetryService
|
||||
type TelemetryService interface {
|
||||
// stats
|
||||
// TrackStats is called periodically for each track in both directions (published/subscribed)
|
||||
TrackStats(streamType livekit.StreamType, participantID livekit.ParticipantID, trackID livekit.TrackID, stat *livekit.AnalyticsStat)
|
||||
|
||||
// events
|
||||
RoomStarted(ctx context.Context, room *livekit.Room)
|
||||
RoomEnded(ctx context.Context, room *livekit.Room)
|
||||
// ParticipantJoined - a participant establishes signal connection to a room
|
||||
ParticipantJoined(ctx context.Context, room *livekit.Room, participant *livekit.ParticipantInfo, clientInfo *livekit.ClientInfo, clientMeta *livekit.AnalyticsClientMeta, shouldSendEvent bool)
|
||||
// ParticipantActive - a participant establishes media connection
|
||||
ParticipantActive(ctx context.Context, room *livekit.Room, participant *livekit.ParticipantInfo, clientMeta *livekit.AnalyticsClientMeta)
|
||||
// ParticipantResumed - there has been an ICE restart or connection resume attempt
|
||||
ParticipantResumed(ctx context.Context, room *livekit.Room, participant *livekit.ParticipantInfo, nodeID livekit.NodeID)
|
||||
// ParticipantLeft - the participant leaves the room, only sent if ParticipantActive has been called before
|
||||
ParticipantLeft(ctx context.Context, room *livekit.Room, participant *livekit.ParticipantInfo, shouldSendEvent bool)
|
||||
// TrackPublishRequested - a publication attempt has been received
|
||||
TrackPublishRequested(ctx context.Context, participantID livekit.ParticipantID, identity livekit.ParticipantIdentity, track *livekit.TrackInfo)
|
||||
// TrackPublished - a publication attempt has been successful
|
||||
TrackPublished(ctx context.Context, participantID livekit.ParticipantID, identity livekit.ParticipantIdentity, track *livekit.TrackInfo)
|
||||
TrackUnpublished(ctx context.Context, participantID livekit.ParticipantID, identity livekit.ParticipantIdentity, track *livekit.TrackInfo, ssrc uint32)
|
||||
// TrackUnpublished - a participant unpublished a track
|
||||
TrackUnpublished(ctx context.Context, participantID livekit.ParticipantID, identity livekit.ParticipantIdentity, track *livekit.TrackInfo, shouldSendEvent bool)
|
||||
// TrackSubscribeRequested - a participant requested to subscribe to a track
|
||||
TrackSubscribeRequested(ctx context.Context, participantID livekit.ParticipantID, track *livekit.TrackInfo, publisher *livekit.ParticipantInfo)
|
||||
// TrackSubscribed - a participant subscribed to a track successfully
|
||||
TrackSubscribed(ctx context.Context, participantID livekit.ParticipantID, track *livekit.TrackInfo, publisher *livekit.ParticipantInfo)
|
||||
// TrackUnsubscribed - a participant unsubscribed from a track successfully
|
||||
TrackUnsubscribed(ctx context.Context, participantID livekit.ParticipantID, track *livekit.TrackInfo)
|
||||
// TrackMuted - the publisher has muted the Track
|
||||
TrackMuted(ctx context.Context, participantID livekit.ParticipantID, track *livekit.TrackInfo)
|
||||
// TrackUnmuted - the publisher has muted the Track
|
||||
TrackUnmuted(ctx context.Context, participantID livekit.ParticipantID, track *livekit.TrackInfo)
|
||||
// TrackPublishedUpdate - track metadata has been updated
|
||||
TrackPublishedUpdate(ctx context.Context, participantID livekit.ParticipantID, track *livekit.TrackInfo)
|
||||
// TrackMaxSubscribedVideoQuality - publisher is notified of the max quality subscribers desire
|
||||
TrackMaxSubscribedVideoQuality(ctx context.Context, participantID livekit.ParticipantID, track *livekit.TrackInfo, mime string, maxQuality livekit.VideoQuality)
|
||||
EgressStarted(ctx context.Context, info *livekit.EgressInfo)
|
||||
EgressEnded(ctx context.Context, info *livekit.EgressInfo)
|
||||
|
||||
Reference in New Issue
Block a user