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:
David Zhao
2023-01-15 15:40:20 -08:00
committed by GitHub
parent 55962e300c
commit 732309a8c1
15 changed files with 535 additions and 178 deletions
@@ -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()