mirror of
https://github.com/livekit/livekit.git
synced 2026-10-23 21:44:29 +00:00
No op implementation to remove stubs in remote (#327)
* No op implementation to remove stubs in remote * Place interface first
This commit is contained in:
1 parent
d6deb6cfa4
commit
e82b8ea0a0
11 files changed
+3467
-139
No files matched your search
@@ -125,7 +125,7 @@ func (l *LocalParticipant) AddMigratedTrack(cid string, ti *livekit.TrackInfo) {
|
||||
}
|
||||
|
||||
func (l *LocalParticipant) SetTrackMuted(trackID livekit.TrackID, muted bool) {
|
||||
track := l.UptrackManager.SetTrackMuted(trackID, muted)
|
||||
track := l.UptrackManager.SetPublishedTrackMuted(trackID, muted)
|
||||
if track != nil {
|
||||
// handled in UptrackManager for a published track, no need to update state of pending track
|
||||
return
|
||||
@@ -336,7 +336,7 @@ func (l *LocalParticipant) setupUptrackManager() {
|
||||
Logger: l.params.Logger,
|
||||
})
|
||||
|
||||
l.UptrackManager.OnClose(l.onUptrackManagerClose)
|
||||
l.UptrackManager.OnUptrackManagerClose(l.onUptrackManagerClose)
|
||||
}
|
||||
|
||||
func (l *LocalParticipant) onUptrackManagerClose() {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package rtc
|
||||
|
||||
type NoOpLocalMediaTrack struct {
|
||||
}
|
||||
|
||||
func (t *NoOpLocalMediaTrack) NotifySubscriberNodeMediaLoss(_nodeID string, _fractionalLoss uint8) {
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
package rtc
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/routing"
|
||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/pion/webrtc/v3"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrUnimplemented = errors.New("unimplemented")
|
||||
)
|
||||
|
||||
type NoOpLocalParticipant struct {
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) ProtocolVersion() types.ProtocolVersion {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) ConnectedAt() time.Time {
|
||||
return time.Time{}
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) State() livekit.ParticipantInfo_State {
|
||||
return livekit.ParticipantInfo_DISCONNECTED
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) IsReady() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) IsRecorder() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) SubscriberAsPrimary() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) GetResponseSink() routing.MessageSink {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) SetResponseSink(_sink routing.MessageSink) {
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) SetPermission(_permission *livekit.ParticipantPermission) {
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) CanPublish() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) CanSubscribe() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) CanPublishData() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) AddICECandidate(_candidate webrtc.ICECandidateInit, _target livekit.SignalTarget) error {
|
||||
return ErrUnimplemented
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) HandleOffer(_sdp webrtc.SessionDescription) (webrtc.SessionDescription, error) {
|
||||
return webrtc.SessionDescription{}, ErrUnimplemented
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) AddTrack(_req *livekit.AddTrackRequest) {
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) SetTrackMuted(_trackID livekit.TrackID, _muted bool, _fromAdmin bool) {
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) SubscriberMediaEngine() *webrtc.MediaEngine {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) SubscriberPC() *webrtc.PeerConnection {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) HandleAnswer(_sdp webrtc.SessionDescription) error {
|
||||
return ErrUnimplemented
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) Negotiate() {
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) ICERestart() error {
|
||||
return ErrUnimplemented
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) AddSubscribedTrack(_subTrack types.SubscribedTrack) {
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) RemoveSubscribedTrack(_subTrack types.SubscribedTrack) {
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) GetSubscribedTrack(_sid livekit.TrackID) types.SubscribedTrack {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) GetSubscribedTracks() []types.SubscribedTrack {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) GetSubscribedParticipants() []livekit.ParticipantID {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *NoOpLocalParticipant) GetAudioLevel() (level uint8, active bool) {
|
||||
return SilentAudioLevel, false
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) GetConnectionQuality() *livekit.ConnectionQualityInfo {
|
||||
return &livekit.ConnectionQualityInfo{}
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) SendJoinResponse(
|
||||
_roomInfo *livekit.Room,
|
||||
_otherParticipants []*livekit.ParticipantInfo,
|
||||
_iceServers []*livekit.ICEServer,
|
||||
) error {
|
||||
return ErrUnimplemented
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) SendParticipantUpdate(_participantsToUpdate []*livekit.ParticipantInfo, updatedAt time.Time) error {
|
||||
return ErrUnimplemented
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) SendSpeakerUpdate(_speakers []*livekit.SpeakerInfo) error {
|
||||
return ErrUnimplemented
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) SendDataPacket(_dp *livekit.DataPacket) error {
|
||||
return ErrUnimplemented
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) SendRoomUpdate(_room *livekit.Room) error {
|
||||
return ErrUnimplemented
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) SendConnectionQualityUpdate(_update *livekit.ConnectionQualityUpdate) error {
|
||||
return ErrUnimplemented
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) SubscriptionPermissionUpdate(_publisherID livekit.ParticipantID, _trackID livekit.TrackID, _allowed bool) {
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) OnStateChange(_callback func(p types.Participant, oldState livekit.ParticipantInfo_State)) {
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) OnTrackUpdated(_callback func(types.Participant, types.PublishedTrack)) {
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) OnMetadataUpdate(_callback func(types.Participant)) {
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) OnDataPacket(_callback func(types.Participant, *livekit.DataPacket)) {
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) OnClose(_callback func(types.Participant, map[livekit.TrackID]livekit.ParticipantID)) {
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) UpdateSubscribedQuality(_nodeID string, _trackID livekit.TrackID, _maxQuality livekit.VideoQuality) error {
|
||||
return ErrUnimplemented
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) UpdateMediaLoss(_nodeID string, _trackID livekit.TrackID, _fractionalLoss uint32) error {
|
||||
return ErrUnimplemented
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) SetMigrateState(_s types.MigrateState) {
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) MigrateState() types.MigrateState {
|
||||
return types.MigrateStateInit
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) AddMigratedTrack(cid string, ti *livekit.TrackInfo) {
|
||||
}
|
||||
|
||||
func (p *NoOpLocalParticipant) SetPreviousAnswer(_previous *webrtc.SessionDescription) {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package rtc
|
||||
|
||||
type NoOpLocalPublishedTrack struct {
|
||||
}
|
||||
|
||||
func (t *NoOpLocalPublishedTrack) GetAudioLevel() (level uint8, active bool) {
|
||||
return SilentAudioLevel, false
|
||||
}
|
||||
|
||||
func (t *NoOpLocalPublishedTrack) GetConnectionScore() float64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (t *NoOpLocalPublishedTrack) SdpCid() (sdpCid string) {
|
||||
return
|
||||
}
|
||||
|
||||
func (t *NoOpLocalPublishedTrack) SignalCid() (signalCid string) {
|
||||
return
|
||||
}
|
||||
@@ -552,7 +552,7 @@ func (p *ParticipantImpl) SendSpeakerUpdate(speakers []*livekit.SpeakerInfo) err
|
||||
var scopedSpeakers []*livekit.SpeakerInfo
|
||||
for _, s := range speakers {
|
||||
participantID := livekit.ParticipantID(s.Sid)
|
||||
if p.IsSubscribedTo(participantID) || participantID == p.ID() {
|
||||
if p.isSubscribedTo(participantID) || participantID == p.ID() {
|
||||
scopedSpeakers = append(scopedSpeakers, s)
|
||||
}
|
||||
}
|
||||
@@ -663,7 +663,7 @@ func (p *ParticipantImpl) GetConnectionQuality() *livekit.ConnectionQualityInfo
|
||||
}
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) IsSubscribedTo(participantID livekit.ParticipantID) bool {
|
||||
func (p *ParticipantImpl) isSubscribedTo(participantID livekit.ParticipantID) bool {
|
||||
_, ok := p.subscribedTo.Load(participantID)
|
||||
return ok
|
||||
}
|
||||
@@ -830,7 +830,7 @@ func (p *ParticipantImpl) setupLocalParticipant() {
|
||||
}
|
||||
})
|
||||
|
||||
p.LocalParticipant.OnTrackUpdated(func(track types.PublishedTrack, onlyIfReady bool) {
|
||||
p.LocalParticipant.OnPublishedTrackUpdated(func(track types.PublishedTrack, onlyIfReady bool) {
|
||||
if onlyIfReady && !p.IsReady() {
|
||||
return
|
||||
}
|
||||
|
||||
+92
-57
@@ -32,85 +32,109 @@ const (
|
||||
MigrateStateComplete
|
||||
)
|
||||
|
||||
//counterfeiter:generate . Participant
|
||||
type Participant interface {
|
||||
ID() livekit.ParticipantID
|
||||
Identity() livekit.ParticipantIdentity
|
||||
State() livekit.ParticipantInfo_State
|
||||
//counterfeiter:generate . LocalParticipant
|
||||
type LocalParticipant interface {
|
||||
ProtocolVersion() ProtocolVersion
|
||||
IsReady() bool
|
||||
|
||||
ConnectedAt() time.Time
|
||||
ToProto() *livekit.ParticipantInfo
|
||||
SetMetadata(metadata string)
|
||||
SetPermission(permission *livekit.ParticipantPermission)
|
||||
|
||||
State() livekit.ParticipantInfo_State
|
||||
IsReady() bool
|
||||
|
||||
IsRecorder() bool
|
||||
|
||||
SubscriberAsPrimary() bool
|
||||
|
||||
GetResponseSink() routing.MessageSink
|
||||
SetResponseSink(sink routing.MessageSink)
|
||||
SubscriberMediaEngine() *webrtc.MediaEngine
|
||||
Negotiate()
|
||||
ICERestart() error
|
||||
SetPreviousAnswer(previous *webrtc.SessionDescription)
|
||||
SetMigrateState(s MigrateState)
|
||||
MigrateState() MigrateState
|
||||
|
||||
// permissions
|
||||
SetPermission(permission *livekit.ParticipantPermission)
|
||||
CanPublish() bool
|
||||
CanSubscribe() bool
|
||||
CanPublishData() bool
|
||||
|
||||
AddICECandidate(candidate webrtc.ICECandidateInit, target livekit.SignalTarget) error
|
||||
|
||||
HandleOffer(sdp webrtc.SessionDescription) (answer webrtc.SessionDescription, err error)
|
||||
|
||||
AddTrack(req *livekit.AddTrackRequest)
|
||||
AddMigratedTrack(cid string, ti *livekit.TrackInfo)
|
||||
GetPublishedTrack(sid livekit.TrackID) PublishedTrack
|
||||
GetPublishedTracks() []PublishedTrack
|
||||
SetTrackMuted(trackID livekit.TrackID, muted bool, fromAdmin bool)
|
||||
|
||||
SubscriberMediaEngine() *webrtc.MediaEngine
|
||||
SubscriberPC() *webrtc.PeerConnection
|
||||
HandleAnswer(sdp webrtc.SessionDescription) error
|
||||
Negotiate()
|
||||
ICERestart() error
|
||||
AddSubscribedTrack(st SubscribedTrack)
|
||||
RemoveSubscribedTrack(st SubscribedTrack)
|
||||
GetSubscribedTrack(sid livekit.TrackID) SubscribedTrack
|
||||
GetSubscribedTracks() []SubscribedTrack
|
||||
HandleOffer(sdp webrtc.SessionDescription) (answer webrtc.SessionDescription, err error)
|
||||
HandleAnswer(sdp webrtc.SessionDescription) error
|
||||
AddICECandidate(candidate webrtc.ICECandidateInit, target livekit.SignalTarget) error
|
||||
AddSubscriber(op Participant, params AddSubscriberParams) (int, error)
|
||||
RemoveSubscriber(op Participant, trackID livekit.TrackID)
|
||||
|
||||
// returns list of participant identities that the current participant is subscribed to
|
||||
GetSubscribedParticipants() []livekit.ParticipantID
|
||||
|
||||
GetAudioLevel() (level uint8, active bool)
|
||||
GetConnectionQuality() *livekit.ConnectionQualityInfo
|
||||
|
||||
// server sent messages
|
||||
SendJoinResponse(info *livekit.Room, otherParticipants []*livekit.ParticipantInfo, iceServers []*livekit.ICEServer) error
|
||||
SendParticipantUpdate(participants []*livekit.ParticipantInfo, updatedAt time.Time) error
|
||||
SendSpeakerUpdate(speakers []*livekit.SpeakerInfo) error
|
||||
SendDataPacket(packet *livekit.DataPacket) error
|
||||
SendRoomUpdate(room *livekit.Room) error
|
||||
SendConnectionQualityUpdate(update *livekit.ConnectionQualityUpdate) error
|
||||
SetTrackMuted(trackID livekit.TrackID, muted bool, fromAdmin bool)
|
||||
GetAudioLevel() (level uint8, active bool)
|
||||
GetConnectionQuality() *livekit.ConnectionQualityInfo
|
||||
IsSubscribedTo(participantID livekit.ParticipantID) bool
|
||||
// returns list of participant identities that the current participant is subscribed to
|
||||
GetSubscribedParticipants() []livekit.ParticipantID
|
||||
SubscriptionPermissionUpdate(publisherID livekit.ParticipantID, trackID livekit.TrackID, allowed bool)
|
||||
|
||||
// callbacks
|
||||
OnStateChange(func(p Participant, oldState livekit.ParticipantInfo_State))
|
||||
// OnTrackUpdated - one of its publishedTracks changed in status
|
||||
OnTrackUpdated(callback func(Participant, PublishedTrack))
|
||||
OnMetadataUpdate(callback func(Participant))
|
||||
OnDataPacket(callback func(Participant, *livekit.DataPacket))
|
||||
OnClose(_callback func(Participant, map[livekit.TrackID]livekit.ParticipantID))
|
||||
|
||||
// updates from remotes
|
||||
UpdateSubscribedQuality(nodeID string, trackID livekit.TrackID, maxQuality livekit.VideoQuality) error
|
||||
UpdateMediaLoss(nodeID string, trackID livekit.TrackID, fractionalLoss uint32) error
|
||||
|
||||
// session migration
|
||||
SetMigrateState(s MigrateState)
|
||||
MigrateState() MigrateState
|
||||
AddMigratedTrack(cid string, ti *livekit.TrackInfo)
|
||||
SetPreviousAnswer(previous *webrtc.SessionDescription)
|
||||
}
|
||||
|
||||
//counterfeiter:generate . Participant
|
||||
type Participant interface {
|
||||
LocalParticipant
|
||||
|
||||
ID() livekit.ParticipantID
|
||||
Identity() livekit.ParticipantIdentity
|
||||
|
||||
ToProto() *livekit.ParticipantInfo
|
||||
|
||||
SetMetadata(metadata string)
|
||||
|
||||
GetPublishedTrack(sid livekit.TrackID) PublishedTrack
|
||||
GetPublishedTracks() []PublishedTrack
|
||||
|
||||
AddSubscriber(op Participant, params AddSubscriberParams) (int, error)
|
||||
RemoveSubscriber(op Participant, trackID livekit.TrackID)
|
||||
|
||||
// permissions
|
||||
CanPublish() bool
|
||||
CanSubscribe() bool
|
||||
CanPublishData() bool
|
||||
Hidden() bool
|
||||
IsRecorder() bool
|
||||
SubscriberAsPrimary() bool
|
||||
|
||||
Start()
|
||||
Close() error
|
||||
|
||||
// callbacks
|
||||
OnStateChange(func(p Participant, oldState livekit.ParticipantInfo_State))
|
||||
// OnTrackPublished - remote added a remoteTrack
|
||||
OnTrackPublished(func(Participant, PublishedTrack))
|
||||
// OnTrackUpdated - one of its publishedTracks changed in status
|
||||
OnTrackUpdated(callback func(Participant, PublishedTrack))
|
||||
OnMetadataUpdate(callback func(Participant))
|
||||
OnDataPacket(callback func(Participant, *livekit.DataPacket))
|
||||
OnClose(func(Participant, map[livekit.TrackID]livekit.ParticipantID))
|
||||
|
||||
// package methods
|
||||
AddSubscribedTrack(st SubscribedTrack)
|
||||
RemoveSubscribedTrack(st SubscribedTrack)
|
||||
SubscriberPC() *webrtc.PeerConnection
|
||||
|
||||
UpdateSubscriptionPermissions(permissions *livekit.UpdateSubscriptionPermissions, resolver func(participantID livekit.ParticipantID) Participant) error
|
||||
SubscriptionPermissionUpdate(publisherID livekit.ParticipantID, trackID livekit.TrackID, allowed bool)
|
||||
|
||||
UpdateVideoLayers(updateVideoLayers *livekit.UpdateVideoLayers) error
|
||||
|
||||
UpdateSubscribedQuality(nodeID string, trackID livekit.TrackID, maxQuality livekit.VideoQuality) error
|
||||
|
||||
UpdateMediaLoss(nodeID string, trackID livekit.TrackID, fractionalLoss uint32) error
|
||||
|
||||
DebugInfo() map[string]interface{}
|
||||
}
|
||||
|
||||
@@ -125,9 +149,16 @@ type Room interface {
|
||||
UpdateVideoLayers(participant Participant, updateVideoLayers *livekit.UpdateVideoLayers) error
|
||||
}
|
||||
|
||||
//counterfeiter:generate . LocalMediaTrack
|
||||
type LocalMediaTrack interface {
|
||||
NotifySubscriberNodeMediaLoss(nodeID string, fractionalLoss uint8)
|
||||
}
|
||||
|
||||
// MediaTrack represents a media track
|
||||
//counterfeiter:generate . MediaTrack
|
||||
type MediaTrack interface {
|
||||
LocalMediaTrack
|
||||
|
||||
ID() livekit.TrackID
|
||||
Kind() livekit.TrackType
|
||||
Name() string
|
||||
@@ -155,8 +186,15 @@ type MediaTrack interface {
|
||||
|
||||
NotifySubscriberMaxQuality(subscriberID livekit.ParticipantID, quality livekit.VideoQuality)
|
||||
NotifySubscriberNodeMaxQuality(nodeID string, quality livekit.VideoQuality)
|
||||
}
|
||||
|
||||
NotifySubscriberNodeMediaLoss(nodeID string, fractionalLoss uint8)
|
||||
//counterfeiter:generate . LocalPublishedTrack
|
||||
type LocalPublishedTrack interface {
|
||||
SignalCid() string
|
||||
SdpCid() string
|
||||
|
||||
GetAudioLevel() (level uint8, active bool)
|
||||
GetConnectionScore() float64
|
||||
}
|
||||
|
||||
// PublishedTrack is the main interface representing a track published to the room
|
||||
@@ -165,14 +203,9 @@ type MediaTrack interface {
|
||||
type PublishedTrack interface {
|
||||
MediaTrack
|
||||
|
||||
SignalCid() string
|
||||
SdpCid() string
|
||||
ToProto() *livekit.TrackInfo
|
||||
|
||||
Receiver() sfu.TrackReceiver
|
||||
GetConnectionScore() float64
|
||||
|
||||
GetAudioLevel() (level uint8, active bool)
|
||||
|
||||
UpdateVideoLayers(layers []*livekit.VideoLayer)
|
||||
|
||||
@@ -180,6 +213,8 @@ type PublishedTrack interface {
|
||||
|
||||
// callbacks
|
||||
AddOnClose(func())
|
||||
|
||||
LocalPublishedTrack
|
||||
}
|
||||
|
||||
//counterfeiter:generate . SubscribedTrack
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
// Code generated by counterfeiter. DO NOT EDIT.
|
||||
package typesfakes
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||
)
|
||||
|
||||
type FakeLocalMediaTrack struct {
|
||||
NotifySubscriberNodeMediaLossStub func(string, uint8)
|
||||
notifySubscriberNodeMediaLossMutex sync.RWMutex
|
||||
notifySubscriberNodeMediaLossArgsForCall []struct {
|
||||
arg1 string
|
||||
arg2 uint8
|
||||
}
|
||||
invocations map[string][][]interface{}
|
||||
invocationsMutex sync.RWMutex
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) NotifySubscriberNodeMediaLoss(arg1 string, arg2 uint8) {
|
||||
fake.notifySubscriberNodeMediaLossMutex.Lock()
|
||||
fake.notifySubscriberNodeMediaLossArgsForCall = append(fake.notifySubscriberNodeMediaLossArgsForCall, struct {
|
||||
arg1 string
|
||||
arg2 uint8
|
||||
}{arg1, arg2})
|
||||
stub := fake.NotifySubscriberNodeMediaLossStub
|
||||
fake.recordInvocation("NotifySubscriberNodeMediaLoss", []interface{}{arg1, arg2})
|
||||
fake.notifySubscriberNodeMediaLossMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.NotifySubscriberNodeMediaLossStub(arg1, arg2)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) NotifySubscriberNodeMediaLossCallCount() int {
|
||||
fake.notifySubscriberNodeMediaLossMutex.RLock()
|
||||
defer fake.notifySubscriberNodeMediaLossMutex.RUnlock()
|
||||
return len(fake.notifySubscriberNodeMediaLossArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) NotifySubscriberNodeMediaLossCalls(stub func(string, uint8)) {
|
||||
fake.notifySubscriberNodeMediaLossMutex.Lock()
|
||||
defer fake.notifySubscriberNodeMediaLossMutex.Unlock()
|
||||
fake.NotifySubscriberNodeMediaLossStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) NotifySubscriberNodeMediaLossArgsForCall(i int) (string, uint8) {
|
||||
fake.notifySubscriberNodeMediaLossMutex.RLock()
|
||||
defer fake.notifySubscriberNodeMediaLossMutex.RUnlock()
|
||||
argsForCall := fake.notifySubscriberNodeMediaLossArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) Invocations() map[string][][]interface{} {
|
||||
fake.invocationsMutex.RLock()
|
||||
defer fake.invocationsMutex.RUnlock()
|
||||
fake.notifySubscriberNodeMediaLossMutex.RLock()
|
||||
defer fake.notifySubscriberNodeMediaLossMutex.RUnlock()
|
||||
copiedInvocations := map[string][][]interface{}{}
|
||||
for key, value := range fake.invocations {
|
||||
copiedInvocations[key] = value
|
||||
}
|
||||
return copiedInvocations
|
||||
}
|
||||
|
||||
func (fake *FakeLocalMediaTrack) recordInvocation(key string, args []interface{}) {
|
||||
fake.invocationsMutex.Lock()
|
||||
defer fake.invocationsMutex.Unlock()
|
||||
if fake.invocations == nil {
|
||||
fake.invocations = map[string][][]interface{}{}
|
||||
}
|
||||
if fake.invocations[key] == nil {
|
||||
fake.invocations[key] = [][]interface{}{}
|
||||
}
|
||||
fake.invocations[key] = append(fake.invocations[key], args)
|
||||
}
|
||||
|
||||
var _ types.LocalMediaTrack = new(FakeLocalMediaTrack)
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,302 @@
|
||||
// Code generated by counterfeiter. DO NOT EDIT.
|
||||
package typesfakes
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||
)
|
||||
|
||||
type FakeLocalPublishedTrack struct {
|
||||
GetAudioLevelStub func() (uint8, bool)
|
||||
getAudioLevelMutex sync.RWMutex
|
||||
getAudioLevelArgsForCall []struct {
|
||||
}
|
||||
getAudioLevelReturns struct {
|
||||
result1 uint8
|
||||
result2 bool
|
||||
}
|
||||
getAudioLevelReturnsOnCall map[int]struct {
|
||||
result1 uint8
|
||||
result2 bool
|
||||
}
|
||||
GetConnectionScoreStub func() float64
|
||||
getConnectionScoreMutex sync.RWMutex
|
||||
getConnectionScoreArgsForCall []struct {
|
||||
}
|
||||
getConnectionScoreReturns struct {
|
||||
result1 float64
|
||||
}
|
||||
getConnectionScoreReturnsOnCall map[int]struct {
|
||||
result1 float64
|
||||
}
|
||||
SdpCidStub func() string
|
||||
sdpCidMutex sync.RWMutex
|
||||
sdpCidArgsForCall []struct {
|
||||
}
|
||||
sdpCidReturns struct {
|
||||
result1 string
|
||||
}
|
||||
sdpCidReturnsOnCall map[int]struct {
|
||||
result1 string
|
||||
}
|
||||
SignalCidStub func() string
|
||||
signalCidMutex sync.RWMutex
|
||||
signalCidArgsForCall []struct {
|
||||
}
|
||||
signalCidReturns struct {
|
||||
result1 string
|
||||
}
|
||||
signalCidReturnsOnCall map[int]struct {
|
||||
result1 string
|
||||
}
|
||||
invocations map[string][][]interface{}
|
||||
invocationsMutex sync.RWMutex
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) GetAudioLevel() (uint8, bool) {
|
||||
fake.getAudioLevelMutex.Lock()
|
||||
ret, specificReturn := fake.getAudioLevelReturnsOnCall[len(fake.getAudioLevelArgsForCall)]
|
||||
fake.getAudioLevelArgsForCall = append(fake.getAudioLevelArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetAudioLevelStub
|
||||
fakeReturns := fake.getAudioLevelReturns
|
||||
fake.recordInvocation("GetAudioLevel", []interface{}{})
|
||||
fake.getAudioLevelMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) GetAudioLevelCallCount() int {
|
||||
fake.getAudioLevelMutex.RLock()
|
||||
defer fake.getAudioLevelMutex.RUnlock()
|
||||
return len(fake.getAudioLevelArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) GetAudioLevelCalls(stub func() (uint8, bool)) {
|
||||
fake.getAudioLevelMutex.Lock()
|
||||
defer fake.getAudioLevelMutex.Unlock()
|
||||
fake.GetAudioLevelStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) GetAudioLevelReturns(result1 uint8, result2 bool) {
|
||||
fake.getAudioLevelMutex.Lock()
|
||||
defer fake.getAudioLevelMutex.Unlock()
|
||||
fake.GetAudioLevelStub = nil
|
||||
fake.getAudioLevelReturns = struct {
|
||||
result1 uint8
|
||||
result2 bool
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) GetAudioLevelReturnsOnCall(i int, result1 uint8, result2 bool) {
|
||||
fake.getAudioLevelMutex.Lock()
|
||||
defer fake.getAudioLevelMutex.Unlock()
|
||||
fake.GetAudioLevelStub = nil
|
||||
if fake.getAudioLevelReturnsOnCall == nil {
|
||||
fake.getAudioLevelReturnsOnCall = make(map[int]struct {
|
||||
result1 uint8
|
||||
result2 bool
|
||||
})
|
||||
}
|
||||
fake.getAudioLevelReturnsOnCall[i] = struct {
|
||||
result1 uint8
|
||||
result2 bool
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) GetConnectionScore() float64 {
|
||||
fake.getConnectionScoreMutex.Lock()
|
||||
ret, specificReturn := fake.getConnectionScoreReturnsOnCall[len(fake.getConnectionScoreArgsForCall)]
|
||||
fake.getConnectionScoreArgsForCall = append(fake.getConnectionScoreArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.GetConnectionScoreStub
|
||||
fakeReturns := fake.getConnectionScoreReturns
|
||||
fake.recordInvocation("GetConnectionScore", []interface{}{})
|
||||
fake.getConnectionScoreMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) GetConnectionScoreCallCount() int {
|
||||
fake.getConnectionScoreMutex.RLock()
|
||||
defer fake.getConnectionScoreMutex.RUnlock()
|
||||
return len(fake.getConnectionScoreArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) GetConnectionScoreCalls(stub func() float64) {
|
||||
fake.getConnectionScoreMutex.Lock()
|
||||
defer fake.getConnectionScoreMutex.Unlock()
|
||||
fake.GetConnectionScoreStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) GetConnectionScoreReturns(result1 float64) {
|
||||
fake.getConnectionScoreMutex.Lock()
|
||||
defer fake.getConnectionScoreMutex.Unlock()
|
||||
fake.GetConnectionScoreStub = nil
|
||||
fake.getConnectionScoreReturns = struct {
|
||||
result1 float64
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) GetConnectionScoreReturnsOnCall(i int, result1 float64) {
|
||||
fake.getConnectionScoreMutex.Lock()
|
||||
defer fake.getConnectionScoreMutex.Unlock()
|
||||
fake.GetConnectionScoreStub = nil
|
||||
if fake.getConnectionScoreReturnsOnCall == nil {
|
||||
fake.getConnectionScoreReturnsOnCall = make(map[int]struct {
|
||||
result1 float64
|
||||
})
|
||||
}
|
||||
fake.getConnectionScoreReturnsOnCall[i] = struct {
|
||||
result1 float64
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) SdpCid() string {
|
||||
fake.sdpCidMutex.Lock()
|
||||
ret, specificReturn := fake.sdpCidReturnsOnCall[len(fake.sdpCidArgsForCall)]
|
||||
fake.sdpCidArgsForCall = append(fake.sdpCidArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.SdpCidStub
|
||||
fakeReturns := fake.sdpCidReturns
|
||||
fake.recordInvocation("SdpCid", []interface{}{})
|
||||
fake.sdpCidMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) SdpCidCallCount() int {
|
||||
fake.sdpCidMutex.RLock()
|
||||
defer fake.sdpCidMutex.RUnlock()
|
||||
return len(fake.sdpCidArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) SdpCidCalls(stub func() string) {
|
||||
fake.sdpCidMutex.Lock()
|
||||
defer fake.sdpCidMutex.Unlock()
|
||||
fake.SdpCidStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) SdpCidReturns(result1 string) {
|
||||
fake.sdpCidMutex.Lock()
|
||||
defer fake.sdpCidMutex.Unlock()
|
||||
fake.SdpCidStub = nil
|
||||
fake.sdpCidReturns = struct {
|
||||
result1 string
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) SdpCidReturnsOnCall(i int, result1 string) {
|
||||
fake.sdpCidMutex.Lock()
|
||||
defer fake.sdpCidMutex.Unlock()
|
||||
fake.SdpCidStub = nil
|
||||
if fake.sdpCidReturnsOnCall == nil {
|
||||
fake.sdpCidReturnsOnCall = make(map[int]struct {
|
||||
result1 string
|
||||
})
|
||||
}
|
||||
fake.sdpCidReturnsOnCall[i] = struct {
|
||||
result1 string
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) SignalCid() string {
|
||||
fake.signalCidMutex.Lock()
|
||||
ret, specificReturn := fake.signalCidReturnsOnCall[len(fake.signalCidArgsForCall)]
|
||||
fake.signalCidArgsForCall = append(fake.signalCidArgsForCall, struct {
|
||||
}{})
|
||||
stub := fake.SignalCidStub
|
||||
fakeReturns := fake.signalCidReturns
|
||||
fake.recordInvocation("SignalCid", []interface{}{})
|
||||
fake.signalCidMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub()
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) SignalCidCallCount() int {
|
||||
fake.signalCidMutex.RLock()
|
||||
defer fake.signalCidMutex.RUnlock()
|
||||
return len(fake.signalCidArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) SignalCidCalls(stub func() string) {
|
||||
fake.signalCidMutex.Lock()
|
||||
defer fake.signalCidMutex.Unlock()
|
||||
fake.SignalCidStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) SignalCidReturns(result1 string) {
|
||||
fake.signalCidMutex.Lock()
|
||||
defer fake.signalCidMutex.Unlock()
|
||||
fake.SignalCidStub = nil
|
||||
fake.signalCidReturns = struct {
|
||||
result1 string
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) SignalCidReturnsOnCall(i int, result1 string) {
|
||||
fake.signalCidMutex.Lock()
|
||||
defer fake.signalCidMutex.Unlock()
|
||||
fake.SignalCidStub = nil
|
||||
if fake.signalCidReturnsOnCall == nil {
|
||||
fake.signalCidReturnsOnCall = make(map[int]struct {
|
||||
result1 string
|
||||
})
|
||||
}
|
||||
fake.signalCidReturnsOnCall[i] = struct {
|
||||
result1 string
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) Invocations() map[string][][]interface{} {
|
||||
fake.invocationsMutex.RLock()
|
||||
defer fake.invocationsMutex.RUnlock()
|
||||
fake.getAudioLevelMutex.RLock()
|
||||
defer fake.getAudioLevelMutex.RUnlock()
|
||||
fake.getConnectionScoreMutex.RLock()
|
||||
defer fake.getConnectionScoreMutex.RUnlock()
|
||||
fake.sdpCidMutex.RLock()
|
||||
defer fake.sdpCidMutex.RUnlock()
|
||||
fake.signalCidMutex.RLock()
|
||||
defer fake.signalCidMutex.RUnlock()
|
||||
copiedInvocations := map[string][][]interface{}{}
|
||||
for key, value := range fake.invocations {
|
||||
copiedInvocations[key] = value
|
||||
}
|
||||
return copiedInvocations
|
||||
}
|
||||
|
||||
func (fake *FakeLocalPublishedTrack) recordInvocation(key string, args []interface{}) {
|
||||
fake.invocationsMutex.Lock()
|
||||
defer fake.invocationsMutex.Unlock()
|
||||
if fake.invocations == nil {
|
||||
fake.invocations = map[string][][]interface{}{}
|
||||
}
|
||||
if fake.invocations[key] == nil {
|
||||
fake.invocations[key] = [][]interface{}{}
|
||||
}
|
||||
fake.invocations[key] = append(fake.invocations[key], args)
|
||||
}
|
||||
|
||||
var _ types.LocalPublishedTrack = new(FakeLocalPublishedTrack)
|
||||
@@ -282,17 +282,6 @@ type FakeParticipant struct {
|
||||
isRecorderReturnsOnCall map[int]struct {
|
||||
result1 bool
|
||||
}
|
||||
IsSubscribedToStub func(livekit.ParticipantID) bool
|
||||
isSubscribedToMutex sync.RWMutex
|
||||
isSubscribedToArgsForCall []struct {
|
||||
arg1 livekit.ParticipantID
|
||||
}
|
||||
isSubscribedToReturns struct {
|
||||
result1 bool
|
||||
}
|
||||
isSubscribedToReturnsOnCall map[int]struct {
|
||||
result1 bool
|
||||
}
|
||||
MigrateStateStub func() types.MigrateState
|
||||
migrateStateMutex sync.RWMutex
|
||||
migrateStateArgsForCall []struct {
|
||||
@@ -2001,67 +1990,6 @@ func (fake *FakeParticipant) IsRecorderReturnsOnCall(i int, result1 bool) {
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) IsSubscribedTo(arg1 livekit.ParticipantID) bool {
|
||||
fake.isSubscribedToMutex.Lock()
|
||||
ret, specificReturn := fake.isSubscribedToReturnsOnCall[len(fake.isSubscribedToArgsForCall)]
|
||||
fake.isSubscribedToArgsForCall = append(fake.isSubscribedToArgsForCall, struct {
|
||||
arg1 livekit.ParticipantID
|
||||
}{arg1})
|
||||
stub := fake.IsSubscribedToStub
|
||||
fakeReturns := fake.isSubscribedToReturns
|
||||
fake.recordInvocation("IsSubscribedTo", []interface{}{arg1})
|
||||
fake.isSubscribedToMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub(arg1)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) IsSubscribedToCallCount() int {
|
||||
fake.isSubscribedToMutex.RLock()
|
||||
defer fake.isSubscribedToMutex.RUnlock()
|
||||
return len(fake.isSubscribedToArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) IsSubscribedToCalls(stub func(livekit.ParticipantID) bool) {
|
||||
fake.isSubscribedToMutex.Lock()
|
||||
defer fake.isSubscribedToMutex.Unlock()
|
||||
fake.IsSubscribedToStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) IsSubscribedToArgsForCall(i int) livekit.ParticipantID {
|
||||
fake.isSubscribedToMutex.RLock()
|
||||
defer fake.isSubscribedToMutex.RUnlock()
|
||||
argsForCall := fake.isSubscribedToArgsForCall[i]
|
||||
return argsForCall.arg1
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) IsSubscribedToReturns(result1 bool) {
|
||||
fake.isSubscribedToMutex.Lock()
|
||||
defer fake.isSubscribedToMutex.Unlock()
|
||||
fake.IsSubscribedToStub = nil
|
||||
fake.isSubscribedToReturns = struct {
|
||||
result1 bool
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) IsSubscribedToReturnsOnCall(i int, result1 bool) {
|
||||
fake.isSubscribedToMutex.Lock()
|
||||
defer fake.isSubscribedToMutex.Unlock()
|
||||
fake.IsSubscribedToStub = nil
|
||||
if fake.isSubscribedToReturnsOnCall == nil {
|
||||
fake.isSubscribedToReturnsOnCall = make(map[int]struct {
|
||||
result1 bool
|
||||
})
|
||||
}
|
||||
fake.isSubscribedToReturnsOnCall[i] = struct {
|
||||
result1 bool
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeParticipant) MigrateState() types.MigrateState {
|
||||
fake.migrateStateMutex.Lock()
|
||||
ret, specificReturn := fake.migrateStateReturnsOnCall[len(fake.migrateStateArgsForCall)]
|
||||
@@ -3661,8 +3589,6 @@ func (fake *FakeParticipant) Invocations() map[string][][]interface{} {
|
||||
defer fake.isReadyMutex.RUnlock()
|
||||
fake.isRecorderMutex.RLock()
|
||||
defer fake.isRecorderMutex.RUnlock()
|
||||
fake.isSubscribedToMutex.RLock()
|
||||
defer fake.isSubscribedToMutex.RUnlock()
|
||||
fake.migrateStateMutex.RLock()
|
||||
defer fake.migrateStateMutex.RUnlock()
|
||||
fake.negotiateMutex.RLock()
|
||||
|
||||
@@ -63,7 +63,7 @@ func (u *UptrackManager) Close() {
|
||||
}
|
||||
}
|
||||
|
||||
func (u *UptrackManager) OnClose(f func()) {
|
||||
func (u *UptrackManager) OnUptrackManagerClose(f func()) {
|
||||
u.onClose = f
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ func (u *UptrackManager) ToProto() []*livekit.TrackInfo {
|
||||
return trackInfos
|
||||
}
|
||||
|
||||
func (u *UptrackManager) OnTrackUpdated(f func(track types.PublishedTrack, onlyIfReady bool)) {
|
||||
func (u *UptrackManager) OnPublishedTrackUpdated(f func(track types.PublishedTrack, onlyIfReady bool)) {
|
||||
u.onTrackUpdated = f
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ func (u *UptrackManager) RemoveSubscriber(sub types.Participant, trackID livekit
|
||||
u.lock.Unlock()
|
||||
}
|
||||
|
||||
func (u *UptrackManager) SetTrackMuted(trackID livekit.TrackID, muted bool) types.PublishedTrack {
|
||||
func (u *UptrackManager) SetPublishedTrackMuted(trackID livekit.TrackID, muted bool) types.PublishedTrack {
|
||||
u.lock.RLock()
|
||||
track := u.publishedTracks[trackID]
|
||||
u.lock.RUnlock()
|
||||
|
||||
Reference in new issue
Block a user