move ConnectedAt to Participant interface (#3383)
This commit is contained in:
@@ -284,7 +284,7 @@ func NewParticipant(params ParticipantParams) (*ParticipantImpl, error) {
|
|||||||
}),
|
}),
|
||||||
pendingTracks: make(map[string]*pendingTrackInfo),
|
pendingTracks: make(map[string]*pendingTrackInfo),
|
||||||
pendingPublishingTracks: make(map[livekit.TrackID]*pendingTrackInfo),
|
pendingPublishingTracks: make(map[livekit.TrackID]*pendingTrackInfo),
|
||||||
connectedAt: time.Now(),
|
connectedAt: time.Now().Truncate(time.Millisecond),
|
||||||
rttUpdatedAt: time.Now(),
|
rttUpdatedAt: time.Now(),
|
||||||
cachedDownTracks: make(map[livekit.TrackID]*downTrackState),
|
cachedDownTracks: make(map[livekit.TrackID]*downTrackState),
|
||||||
dataChannelStats: telemetry.NewBytesTrackStats(
|
dataChannelStats: telemetry.NewBytesTrackStats(
|
||||||
|
|||||||
@@ -264,6 +264,7 @@ type Participant interface {
|
|||||||
ID() livekit.ParticipantID
|
ID() livekit.ParticipantID
|
||||||
Identity() livekit.ParticipantIdentity
|
Identity() livekit.ParticipantIdentity
|
||||||
State() livekit.ParticipantInfo_State
|
State() livekit.ParticipantInfo_State
|
||||||
|
ConnectedAt() time.Time
|
||||||
CloseReason() ParticipantCloseReason
|
CloseReason() ParticipantCloseReason
|
||||||
Kind() livekit.ParticipantInfo_Kind
|
Kind() livekit.ParticipantInfo_Kind
|
||||||
IsRecorder() bool
|
IsRecorder() bool
|
||||||
@@ -324,7 +325,6 @@ type LocalParticipant interface {
|
|||||||
ProtocolVersion() ProtocolVersion
|
ProtocolVersion() ProtocolVersion
|
||||||
SupportsSyncStreamID() bool
|
SupportsSyncStreamID() bool
|
||||||
SupportsTransceiverReuse() bool
|
SupportsTransceiverReuse() bool
|
||||||
ConnectedAt() time.Time
|
|
||||||
IsClosed() bool
|
IsClosed() bool
|
||||||
IsReady() bool
|
IsReady() bool
|
||||||
IsDisconnected() bool
|
IsDisconnected() bool
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package typesfakes
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||||
"github.com/livekit/protocol/livekit"
|
"github.com/livekit/protocol/livekit"
|
||||||
@@ -43,6 +44,16 @@ type FakeParticipant struct {
|
|||||||
closeReasonReturnsOnCall map[int]struct {
|
closeReasonReturnsOnCall map[int]struct {
|
||||||
result1 types.ParticipantCloseReason
|
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{}
|
DebugInfoStub func() map[string]interface{}
|
||||||
debugInfoMutex sync.RWMutex
|
debugInfoMutex sync.RWMutex
|
||||||
debugInfoArgsForCall []struct {
|
debugInfoArgsForCall []struct {
|
||||||
@@ -418,6 +429,59 @@ func (fake *FakeParticipant) CloseReasonReturnsOnCall(i int, result1 types.Parti
|
|||||||
}{result1}
|
}{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{} {
|
func (fake *FakeParticipant) DebugInfo() map[string]interface{} {
|
||||||
fake.debugInfoMutex.Lock()
|
fake.debugInfoMutex.Lock()
|
||||||
ret, specificReturn := fake.debugInfoReturnsOnCall[len(fake.debugInfoArgsForCall)]
|
ret, specificReturn := fake.debugInfoReturnsOnCall[len(fake.debugInfoArgsForCall)]
|
||||||
@@ -1480,6 +1544,8 @@ func (fake *FakeParticipant) Invocations() map[string][][]interface{} {
|
|||||||
defer fake.closeMutex.RUnlock()
|
defer fake.closeMutex.RUnlock()
|
||||||
fake.closeReasonMutex.RLock()
|
fake.closeReasonMutex.RLock()
|
||||||
defer fake.closeReasonMutex.RUnlock()
|
defer fake.closeReasonMutex.RUnlock()
|
||||||
|
fake.connectedAtMutex.RLock()
|
||||||
|
defer fake.connectedAtMutex.RUnlock()
|
||||||
fake.debugInfoMutex.RLock()
|
fake.debugInfoMutex.RLock()
|
||||||
defer fake.debugInfoMutex.RUnlock()
|
defer fake.debugInfoMutex.RUnlock()
|
||||||
fake.getAudioLevelMutex.RLock()
|
fake.getAudioLevelMutex.RLock()
|
||||||
|
|||||||
Reference in New Issue
Block a user