From 9b0539eb437030a2bffb5447bebd010cbf50f1e6 Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Mon, 29 Aug 2022 13:19:58 +0530 Subject: [PATCH] Need this for clean up during migration (#965) --- pkg/rtc/types/interfaces.go | 1 + .../typesfakes/fake_local_participant.go | 41 +++++++++++++++++++ pkg/rtc/types/typesfakes/fake_participant.go | 41 +++++++++++++++++++ 3 files changed, 83 insertions(+) diff --git a/pkg/rtc/types/interfaces.go b/pkg/rtc/types/interfaces.go index e4158f971..b3716ad99 100644 --- a/pkg/rtc/types/interfaces.go +++ b/pkg/rtc/types/interfaces.go @@ -178,6 +178,7 @@ type Participant interface { GetPublishedTrack(sid livekit.TrackID) MediaTrack GetPublishedTracks() []MediaTrack + RemovePublishedTrack(track MediaTrack, willBeResumed bool) AddSubscriber(op LocalParticipant, params AddSubscriberParams) (int, error) RemoveSubscriber(op LocalParticipant, trackID livekit.TrackID, resume bool) diff --git a/pkg/rtc/types/typesfakes/fake_local_participant.go b/pkg/rtc/types/typesfakes/fake_local_participant.go index a3b04be25..27a306494 100644 --- a/pkg/rtc/types/typesfakes/fake_local_participant.go +++ b/pkg/rtc/types/typesfakes/fake_local_participant.go @@ -459,6 +459,12 @@ type FakeLocalParticipant struct { protocolVersionReturnsOnCall map[int]struct { result1 types.ProtocolVersion } + RemovePublishedTrackStub func(types.MediaTrack, bool) + removePublishedTrackMutex sync.RWMutex + removePublishedTrackArgsForCall []struct { + arg1 types.MediaTrack + arg2 bool + } RemoveSubscribedTrackStub func(types.SubscribedTrack) removeSubscribedTrackMutex sync.RWMutex removeSubscribedTrackArgsForCall []struct { @@ -3145,6 +3151,39 @@ func (fake *FakeLocalParticipant) ProtocolVersionReturnsOnCall(i int, result1 ty }{result1} } +func (fake *FakeLocalParticipant) RemovePublishedTrack(arg1 types.MediaTrack, arg2 bool) { + fake.removePublishedTrackMutex.Lock() + fake.removePublishedTrackArgsForCall = append(fake.removePublishedTrackArgsForCall, struct { + arg1 types.MediaTrack + arg2 bool + }{arg1, arg2}) + stub := fake.RemovePublishedTrackStub + fake.recordInvocation("RemovePublishedTrack", []interface{}{arg1, arg2}) + fake.removePublishedTrackMutex.Unlock() + if stub != nil { + fake.RemovePublishedTrackStub(arg1, arg2) + } +} + +func (fake *FakeLocalParticipant) RemovePublishedTrackCallCount() int { + fake.removePublishedTrackMutex.RLock() + defer fake.removePublishedTrackMutex.RUnlock() + return len(fake.removePublishedTrackArgsForCall) +} + +func (fake *FakeLocalParticipant) RemovePublishedTrackCalls(stub func(types.MediaTrack, bool)) { + fake.removePublishedTrackMutex.Lock() + defer fake.removePublishedTrackMutex.Unlock() + fake.RemovePublishedTrackStub = stub +} + +func (fake *FakeLocalParticipant) RemovePublishedTrackArgsForCall(i int) (types.MediaTrack, bool) { + fake.removePublishedTrackMutex.RLock() + defer fake.removePublishedTrackMutex.RUnlock() + argsForCall := fake.removePublishedTrackArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + func (fake *FakeLocalParticipant) RemoveSubscribedTrack(arg1 types.SubscribedTrack) { fake.removeSubscribedTrackMutex.Lock() fake.removeSubscribedTrackArgsForCall = append(fake.removeSubscribedTrackArgsForCall, struct { @@ -4740,6 +4779,8 @@ func (fake *FakeLocalParticipant) Invocations() map[string][][]interface{} { defer fake.processSubscriptionRequestsQueueMutex.RUnlock() fake.protocolVersionMutex.RLock() defer fake.protocolVersionMutex.RUnlock() + fake.removePublishedTrackMutex.RLock() + defer fake.removePublishedTrackMutex.RUnlock() fake.removeSubscribedTrackMutex.RLock() defer fake.removeSubscribedTrackMutex.RUnlock() fake.removeSubscriberMutex.RLock() diff --git a/pkg/rtc/types/typesfakes/fake_participant.go b/pkg/rtc/types/typesfakes/fake_participant.go index 70400a314..05c3ebd47 100644 --- a/pkg/rtc/types/typesfakes/fake_participant.go +++ b/pkg/rtc/types/typesfakes/fake_participant.go @@ -106,6 +106,12 @@ type FakeParticipant struct { isRecorderReturnsOnCall map[int]struct { result1 bool } + RemovePublishedTrackStub func(types.MediaTrack, bool) + removePublishedTrackMutex sync.RWMutex + removePublishedTrackArgsForCall []struct { + arg1 types.MediaTrack + arg2 bool + } RemoveSubscriberStub func(types.LocalParticipant, livekit.TrackID, bool) removeSubscriberMutex sync.RWMutex removeSubscriberArgsForCall []struct { @@ -679,6 +685,39 @@ func (fake *FakeParticipant) IsRecorderReturnsOnCall(i int, result1 bool) { }{result1} } +func (fake *FakeParticipant) RemovePublishedTrack(arg1 types.MediaTrack, arg2 bool) { + fake.removePublishedTrackMutex.Lock() + fake.removePublishedTrackArgsForCall = append(fake.removePublishedTrackArgsForCall, struct { + arg1 types.MediaTrack + arg2 bool + }{arg1, arg2}) + stub := fake.RemovePublishedTrackStub + fake.recordInvocation("RemovePublishedTrack", []interface{}{arg1, arg2}) + fake.removePublishedTrackMutex.Unlock() + if stub != nil { + fake.RemovePublishedTrackStub(arg1, arg2) + } +} + +func (fake *FakeParticipant) RemovePublishedTrackCallCount() int { + fake.removePublishedTrackMutex.RLock() + defer fake.removePublishedTrackMutex.RUnlock() + return len(fake.removePublishedTrackArgsForCall) +} + +func (fake *FakeParticipant) RemovePublishedTrackCalls(stub func(types.MediaTrack, bool)) { + fake.removePublishedTrackMutex.Lock() + defer fake.removePublishedTrackMutex.Unlock() + fake.RemovePublishedTrackStub = stub +} + +func (fake *FakeParticipant) RemovePublishedTrackArgsForCall(i int) (types.MediaTrack, bool) { + fake.removePublishedTrackMutex.RLock() + defer fake.removePublishedTrackMutex.RUnlock() + argsForCall := fake.removePublishedTrackArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + func (fake *FakeParticipant) RemoveSubscriber(arg1 types.LocalParticipant, arg2 livekit.TrackID, arg3 bool) { fake.removeSubscriberMutex.Lock() fake.removeSubscriberArgsForCall = append(fake.removeSubscriberArgsForCall, struct { @@ -1024,6 +1063,8 @@ func (fake *FakeParticipant) Invocations() map[string][][]interface{} { defer fake.identityMutex.RUnlock() fake.isRecorderMutex.RLock() defer fake.isRecorderMutex.RUnlock() + fake.removePublishedTrackMutex.RLock() + defer fake.removePublishedTrackMutex.RUnlock() fake.removeSubscriberMutex.RLock() defer fake.removeSubscriberMutex.RUnlock() fake.setMetadataMutex.RLock()