backwards compatability for IsRecorder (#2647)

* backwards compatability for IsRecorder

* regenerate fakes
This commit is contained in:
David Colburn
2024-04-11 11:14:15 -07:00
committed by GitHub
parent d55948f761
commit 990cf6877b
5 changed files with 141 additions and 3 deletions
+7
View File
@@ -332,6 +332,13 @@ func (p *ParticipantImpl) Kind() livekit.ParticipantInfo_Kind {
return p.grants.GetParticipantKind()
}
func (p *ParticipantImpl) IsRecorder() bool {
p.lock.RLock()
defer p.lock.RUnlock()
return p.grants.GetParticipantKind() == livekit.ParticipantInfo_EGRESS || p.grants.Video.Recorder
}
func (p *ParticipantImpl) IsDependent() bool {
p.lock.RLock()
defer p.lock.RUnlock()
+3 -3
View File
@@ -417,7 +417,7 @@ func (r *Room) Join(participant types.LocalParticipant, requestSource routing.Me
"numParticipants", len(r.participants),
)
if participant.Kind() == livekit.ParticipantInfo_EGRESS && !r.protoRoom.ActiveRecording {
if participant.IsRecorder() && !r.protoRoom.ActiveRecording {
r.protoRoom.ActiveRecording = true
r.protoProxy.MarkDirty(true)
} else {
@@ -559,10 +559,10 @@ func (r *Room) RemoveParticipant(identity livekit.ParticipantIdentity, pID livek
}
immediateChange := false
if p.Kind() == livekit.ParticipantInfo_EGRESS {
if p.IsRecorder() {
activeRecording := false
for _, op := range r.participants {
if op.Kind() == livekit.ParticipantInfo_EGRESS {
if op.IsRecorder() {
activeRecording = true
break
}
+1
View File
@@ -246,6 +246,7 @@ type Participant interface {
State() livekit.ParticipantInfo_State
CloseReason() ParticipantCloseReason
Kind() livekit.ParticipantInfo_Kind
IsRecorder() bool
IsDependent() bool
CanSkipBroadcast() bool
@@ -504,6 +504,16 @@ type FakeLocalParticipant struct {
isReadyReturnsOnCall map[int]struct {
result1 bool
}
IsRecorderStub func() bool
isRecorderMutex sync.RWMutex
isRecorderArgsForCall []struct {
}
isRecorderReturns struct {
result1 bool
}
isRecorderReturnsOnCall map[int]struct {
result1 bool
}
IsSubscribedToStub func(livekit.ParticipantID) bool
isSubscribedToMutex sync.RWMutex
isSubscribedToArgsForCall []struct {
@@ -3551,6 +3561,59 @@ func (fake *FakeLocalParticipant) IsReadyReturnsOnCall(i int, result1 bool) {
}{result1}
}
func (fake *FakeLocalParticipant) IsRecorder() bool {
fake.isRecorderMutex.Lock()
ret, specificReturn := fake.isRecorderReturnsOnCall[len(fake.isRecorderArgsForCall)]
fake.isRecorderArgsForCall = append(fake.isRecorderArgsForCall, struct {
}{})
stub := fake.IsRecorderStub
fakeReturns := fake.isRecorderReturns
fake.recordInvocation("IsRecorder", []interface{}{})
fake.isRecorderMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeLocalParticipant) IsRecorderCallCount() int {
fake.isRecorderMutex.RLock()
defer fake.isRecorderMutex.RUnlock()
return len(fake.isRecorderArgsForCall)
}
func (fake *FakeLocalParticipant) IsRecorderCalls(stub func() bool) {
fake.isRecorderMutex.Lock()
defer fake.isRecorderMutex.Unlock()
fake.IsRecorderStub = stub
}
func (fake *FakeLocalParticipant) IsRecorderReturns(result1 bool) {
fake.isRecorderMutex.Lock()
defer fake.isRecorderMutex.Unlock()
fake.IsRecorderStub = nil
fake.isRecorderReturns = struct {
result1 bool
}{result1}
}
func (fake *FakeLocalParticipant) IsRecorderReturnsOnCall(i int, result1 bool) {
fake.isRecorderMutex.Lock()
defer fake.isRecorderMutex.Unlock()
fake.IsRecorderStub = nil
if fake.isRecorderReturnsOnCall == nil {
fake.isRecorderReturnsOnCall = make(map[int]struct {
result1 bool
})
}
fake.isRecorderReturnsOnCall[i] = struct {
result1 bool
}{result1}
}
func (fake *FakeLocalParticipant) IsSubscribedTo(arg1 livekit.ParticipantID) bool {
fake.isSubscribedToMutex.Lock()
ret, specificReturn := fake.isSubscribedToReturnsOnCall[len(fake.isSubscribedToArgsForCall)]
@@ -6415,6 +6478,8 @@ func (fake *FakeLocalParticipant) Invocations() map[string][][]interface{} {
defer fake.isPublisherMutex.RUnlock()
fake.isReadyMutex.RLock()
defer fake.isReadyMutex.RUnlock()
fake.isRecorderMutex.RLock()
defer fake.isRecorderMutex.RUnlock()
fake.isSubscribedToMutex.RLock()
defer fake.isSubscribedToMutex.RUnlock()
fake.issueFullReconnectMutex.RLock()
@@ -148,6 +148,16 @@ type FakeParticipant struct {
isPublisherReturnsOnCall map[int]struct {
result1 bool
}
IsRecorderStub func() bool
isRecorderMutex sync.RWMutex
isRecorderArgsForCall []struct {
}
isRecorderReturns struct {
result1 bool
}
isRecorderReturnsOnCall map[int]struct {
result1 bool
}
KindStub func() livekit.ParticipantInfo_Kind
kindMutex sync.RWMutex
kindArgsForCall []struct {
@@ -954,6 +964,59 @@ func (fake *FakeParticipant) IsPublisherReturnsOnCall(i int, result1 bool) {
}{result1}
}
func (fake *FakeParticipant) IsRecorder() bool {
fake.isRecorderMutex.Lock()
ret, specificReturn := fake.isRecorderReturnsOnCall[len(fake.isRecorderArgsForCall)]
fake.isRecorderArgsForCall = append(fake.isRecorderArgsForCall, struct {
}{})
stub := fake.IsRecorderStub
fakeReturns := fake.isRecorderReturns
fake.recordInvocation("IsRecorder", []interface{}{})
fake.isRecorderMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeParticipant) IsRecorderCallCount() int {
fake.isRecorderMutex.RLock()
defer fake.isRecorderMutex.RUnlock()
return len(fake.isRecorderArgsForCall)
}
func (fake *FakeParticipant) IsRecorderCalls(stub func() bool) {
fake.isRecorderMutex.Lock()
defer fake.isRecorderMutex.Unlock()
fake.IsRecorderStub = stub
}
func (fake *FakeParticipant) IsRecorderReturns(result1 bool) {
fake.isRecorderMutex.Lock()
defer fake.isRecorderMutex.Unlock()
fake.IsRecorderStub = nil
fake.isRecorderReturns = struct {
result1 bool
}{result1}
}
func (fake *FakeParticipant) IsRecorderReturnsOnCall(i int, result1 bool) {
fake.isRecorderMutex.Lock()
defer fake.isRecorderMutex.Unlock()
fake.IsRecorderStub = nil
if fake.isRecorderReturnsOnCall == nil {
fake.isRecorderReturnsOnCall = make(map[int]struct {
result1 bool
})
}
fake.isRecorderReturnsOnCall[i] = struct {
result1 bool
}{result1}
}
func (fake *FakeParticipant) Kind() livekit.ParticipantInfo_Kind {
fake.kindMutex.Lock()
ret, specificReturn := fake.kindReturnsOnCall[len(fake.kindArgsForCall)]
@@ -1420,6 +1483,8 @@ func (fake *FakeParticipant) Invocations() map[string][][]interface{} {
defer fake.isDependentMutex.RUnlock()
fake.isPublisherMutex.RLock()
defer fake.isPublisherMutex.RUnlock()
fake.isRecorderMutex.RLock()
defer fake.isRecorderMutex.RUnlock()
fake.kindMutex.RLock()
defer fake.kindMutex.RUnlock()
fake.removePublishedTrackMutex.RLock()