move ConnectedAt to Participant interface (#3383)

This commit is contained in:
Paul Wells
2025-01-30 05:45:47 -08:00
committed by GitHub
parent a4ccc7cc7f
commit 3970e965f6
3 changed files with 68 additions and 2 deletions
+1 -1
View File
@@ -284,7 +284,7 @@ func NewParticipant(params ParticipantParams) (*ParticipantImpl, error) {
}),
pendingTracks: make(map[string]*pendingTrackInfo),
pendingPublishingTracks: make(map[livekit.TrackID]*pendingTrackInfo),
connectedAt: time.Now(),
connectedAt: time.Now().Truncate(time.Millisecond),
rttUpdatedAt: time.Now(),
cachedDownTracks: make(map[livekit.TrackID]*downTrackState),
dataChannelStats: telemetry.NewBytesTrackStats(
+1 -1
View File
@@ -264,6 +264,7 @@ type Participant interface {
ID() livekit.ParticipantID
Identity() livekit.ParticipantIdentity
State() livekit.ParticipantInfo_State
ConnectedAt() time.Time
CloseReason() ParticipantCloseReason
Kind() livekit.ParticipantInfo_Kind
IsRecorder() bool
@@ -324,7 +325,6 @@ type LocalParticipant interface {
ProtocolVersion() ProtocolVersion
SupportsSyncStreamID() bool
SupportsTransceiverReuse() bool
ConnectedAt() time.Time
IsClosed() bool
IsReady() bool
IsDisconnected() bool
@@ -3,6 +3,7 @@ package typesfakes
import (
"sync"
"time"
"github.com/livekit/livekit-server/pkg/rtc/types"
"github.com/livekit/protocol/livekit"
@@ -43,6 +44,16 @@ type FakeParticipant struct {
closeReasonReturnsOnCall map[int]struct {
result1 types.ParticipantCloseReason
}
ConnectedAtStub func() time.Time
connectedAtMutex sync.RWMutex
connectedAtArgsForCall []struct {
}
connectedAtReturns struct {
result1 time.Time
}
connectedAtReturnsOnCall map[int]struct {
result1 time.Time
}
DebugInfoStub func() map[string]interface{}
debugInfoMutex sync.RWMutex
debugInfoArgsForCall []struct {
@@ -418,6 +429,59 @@ func (fake *FakeParticipant) CloseReasonReturnsOnCall(i int, result1 types.Parti
}{result1}
}
func (fake *FakeParticipant) ConnectedAt() time.Time {
fake.connectedAtMutex.Lock()
ret, specificReturn := fake.connectedAtReturnsOnCall[len(fake.connectedAtArgsForCall)]
fake.connectedAtArgsForCall = append(fake.connectedAtArgsForCall, struct {
}{})
stub := fake.ConnectedAtStub
fakeReturns := fake.connectedAtReturns
fake.recordInvocation("ConnectedAt", []interface{}{})
fake.connectedAtMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeParticipant) ConnectedAtCallCount() int {
fake.connectedAtMutex.RLock()
defer fake.connectedAtMutex.RUnlock()
return len(fake.connectedAtArgsForCall)
}
func (fake *FakeParticipant) ConnectedAtCalls(stub func() time.Time) {
fake.connectedAtMutex.Lock()
defer fake.connectedAtMutex.Unlock()
fake.ConnectedAtStub = stub
}
func (fake *FakeParticipant) ConnectedAtReturns(result1 time.Time) {
fake.connectedAtMutex.Lock()
defer fake.connectedAtMutex.Unlock()
fake.ConnectedAtStub = nil
fake.connectedAtReturns = struct {
result1 time.Time
}{result1}
}
func (fake *FakeParticipant) ConnectedAtReturnsOnCall(i int, result1 time.Time) {
fake.connectedAtMutex.Lock()
defer fake.connectedAtMutex.Unlock()
fake.ConnectedAtStub = nil
if fake.connectedAtReturnsOnCall == nil {
fake.connectedAtReturnsOnCall = make(map[int]struct {
result1 time.Time
})
}
fake.connectedAtReturnsOnCall[i] = struct {
result1 time.Time
}{result1}
}
func (fake *FakeParticipant) DebugInfo() map[string]interface{} {
fake.debugInfoMutex.Lock()
ret, specificReturn := fake.debugInfoReturnsOnCall[len(fake.debugInfoArgsForCall)]
@@ -1480,6 +1544,8 @@ func (fake *FakeParticipant) Invocations() map[string][][]interface{} {
defer fake.closeMutex.RUnlock()
fake.closeReasonMutex.RLock()
defer fake.closeReasonMutex.RUnlock()
fake.connectedAtMutex.RLock()
defer fake.connectedAtMutex.RUnlock()
fake.debugInfoMutex.RLock()
defer fake.debugInfoMutex.RUnlock()
fake.getAudioLevelMutex.RLock()