Add GetClientInfo interface, to be used to decide migration vs full-reconenct (#1827)

This commit is contained in:
Raja Subramanian
2023-06-26 23:15:53 +05:30
committed by GitHub
parent 95f360bbce
commit 352bb1d204
3 changed files with 72 additions and 0 deletions
+6
View File
@@ -279,6 +279,12 @@ func (p *ParticipantImpl) ConnectedAt() time.Time {
return p.connectedAt
}
func (p *ParticipantImpl) GetClientInfo() *livekit.ClientInfo {
p.lock.RLock()
defer p.lock.RUnlock()
return p.params.ClientInfo.ClientInfo
}
func (p *ParticipantImpl) GetClientConfiguration() *livekit.ClientConfiguration {
p.lock.RLock()
defer p.lock.RUnlock()
+1
View File
@@ -285,6 +285,7 @@ type LocalParticipant interface {
IsDisconnected() bool
IsIdle() bool
SubscriberAsPrimary() bool
GetClientInfo() *livekit.ClientInfo
GetClientConfiguration() *livekit.ClientConfiguration
GetICEConnectionType() ICEConnectionType
GetBufferFactory() *buffer.Factory
@@ -212,6 +212,16 @@ type FakeLocalParticipant struct {
getClientConfigurationReturnsOnCall map[int]struct {
result1 *livekit.ClientConfiguration
}
GetClientInfoStub func() *livekit.ClientInfo
getClientInfoMutex sync.RWMutex
getClientInfoArgsForCall []struct {
}
getClientInfoReturns struct {
result1 *livekit.ClientInfo
}
getClientInfoReturnsOnCall map[int]struct {
result1 *livekit.ClientInfo
}
GetConnectionQualityStub func() *livekit.ConnectionQualityInfo
getConnectionQualityMutex sync.RWMutex
getConnectionQualityArgsForCall []struct {
@@ -1849,6 +1859,59 @@ func (fake *FakeLocalParticipant) GetClientConfigurationReturnsOnCall(i int, res
}{result1}
}
func (fake *FakeLocalParticipant) GetClientInfo() *livekit.ClientInfo {
fake.getClientInfoMutex.Lock()
ret, specificReturn := fake.getClientInfoReturnsOnCall[len(fake.getClientInfoArgsForCall)]
fake.getClientInfoArgsForCall = append(fake.getClientInfoArgsForCall, struct {
}{})
stub := fake.GetClientInfoStub
fakeReturns := fake.getClientInfoReturns
fake.recordInvocation("GetClientInfo", []interface{}{})
fake.getClientInfoMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeLocalParticipant) GetClientInfoCallCount() int {
fake.getClientInfoMutex.RLock()
defer fake.getClientInfoMutex.RUnlock()
return len(fake.getClientInfoArgsForCall)
}
func (fake *FakeLocalParticipant) GetClientInfoCalls(stub func() *livekit.ClientInfo) {
fake.getClientInfoMutex.Lock()
defer fake.getClientInfoMutex.Unlock()
fake.GetClientInfoStub = stub
}
func (fake *FakeLocalParticipant) GetClientInfoReturns(result1 *livekit.ClientInfo) {
fake.getClientInfoMutex.Lock()
defer fake.getClientInfoMutex.Unlock()
fake.GetClientInfoStub = nil
fake.getClientInfoReturns = struct {
result1 *livekit.ClientInfo
}{result1}
}
func (fake *FakeLocalParticipant) GetClientInfoReturnsOnCall(i int, result1 *livekit.ClientInfo) {
fake.getClientInfoMutex.Lock()
defer fake.getClientInfoMutex.Unlock()
fake.GetClientInfoStub = nil
if fake.getClientInfoReturnsOnCall == nil {
fake.getClientInfoReturnsOnCall = make(map[int]struct {
result1 *livekit.ClientInfo
})
}
fake.getClientInfoReturnsOnCall[i] = struct {
result1 *livekit.ClientInfo
}{result1}
}
func (fake *FakeLocalParticipant) GetConnectionQuality() *livekit.ConnectionQualityInfo {
fake.getConnectionQualityMutex.Lock()
ret, specificReturn := fake.getConnectionQualityReturnsOnCall[len(fake.getConnectionQualityArgsForCall)]
@@ -5475,6 +5538,8 @@ func (fake *FakeLocalParticipant) Invocations() map[string][][]interface{} {
defer fake.getCachedDownTrackMutex.RUnlock()
fake.getClientConfigurationMutex.RLock()
defer fake.getClientConfigurationMutex.RUnlock()
fake.getClientInfoMutex.RLock()
defer fake.getClientInfoMutex.RUnlock()
fake.getConnectionQualityMutex.RLock()
defer fake.getConnectionQualityMutex.RUnlock()
fake.getICEConnectionTypeMutex.RLock()