@@ -20,7 +20,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pion/webrtc/v3"
|
"github.com/pion/webrtc/v3"
|
||||||
"go.uber.org/atomic"
|
|
||||||
|
|
||||||
"github.com/livekit/protocol/livekit"
|
"github.com/livekit/protocol/livekit"
|
||||||
"github.com/livekit/protocol/logger"
|
"github.com/livekit/protocol/logger"
|
||||||
@@ -270,13 +269,7 @@ func (p *ParticipantImpl) sendDisconnectUpdatesForReconnect() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *ParticipantImpl) sendICECandidate(ic *webrtc.ICECandidate, target livekit.SignalTarget) error {
|
func (p *ParticipantImpl) sendICECandidate(ic *webrtc.ICECandidate, target livekit.SignalTarget) error {
|
||||||
var icQueue *atomic.Pointer[webrtc.ICECandidate]
|
prevIC := p.icQueue[target].Swap(ic)
|
||||||
if target == livekit.SignalTarget_PUBLISHER {
|
|
||||||
icQueue = &p.icQueue[0]
|
|
||||||
} else {
|
|
||||||
icQueue = &p.icQueue[1]
|
|
||||||
}
|
|
||||||
prevIC := icQueue.Swap(ic)
|
|
||||||
if prevIC == nil {
|
if prevIC == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -603,6 +603,7 @@ func (r *RoomManager) getOrCreateRoom(ctx context.Context, createRoom *livekit.C
|
|||||||
agentDispatchServer := must.Get(rpc.NewTypedAgentDispatchInternalServer(r, r.bus))
|
agentDispatchServer := must.Get(rpc.NewTypedAgentDispatchInternalServer(r, r.bus))
|
||||||
killDispServer := r.agentDispatchServers.Replace(roomTopic, agentDispatchServer)
|
killDispServer := r.agentDispatchServers.Replace(roomTopic, agentDispatchServer)
|
||||||
if err := agentDispatchServer.RegisterAllRoomTopics(roomTopic); err != nil {
|
if err := agentDispatchServer.RegisterAllRoomTopics(roomTopic); err != nil {
|
||||||
|
killRoomServer()
|
||||||
killDispServer()
|
killDispServer()
|
||||||
r.lock.Unlock()
|
r.lock.Unlock()
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import (
|
|||||||
"github.com/twitchtv/twirp"
|
"github.com/twitchtv/twirp"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
|
|
||||||
"github.com/livekit/livekit-server/pkg/agent"
|
|
||||||
"github.com/livekit/livekit-server/pkg/config"
|
"github.com/livekit/livekit-server/pkg/config"
|
||||||
"github.com/livekit/livekit-server/pkg/routing"
|
"github.com/livekit/livekit-server/pkg/routing"
|
||||||
"github.com/livekit/livekit-server/pkg/rtc"
|
"github.com/livekit/livekit-server/pkg/rtc"
|
||||||
@@ -39,7 +38,6 @@ type RoomService struct {
|
|||||||
router routing.MessageRouter
|
router routing.MessageRouter
|
||||||
roomAllocator RoomAllocator
|
roomAllocator RoomAllocator
|
||||||
roomStore ServiceStore
|
roomStore ServiceStore
|
||||||
agentClient agent.Client
|
|
||||||
egressLauncher rtc.EgressLauncher
|
egressLauncher rtc.EgressLauncher
|
||||||
topicFormatter rpc.TopicFormatter
|
topicFormatter rpc.TopicFormatter
|
||||||
roomClient rpc.TypedRoomClient
|
roomClient rpc.TypedRoomClient
|
||||||
@@ -52,7 +50,6 @@ func NewRoomService(
|
|||||||
router routing.MessageRouter,
|
router routing.MessageRouter,
|
||||||
roomAllocator RoomAllocator,
|
roomAllocator RoomAllocator,
|
||||||
serviceStore ServiceStore,
|
serviceStore ServiceStore,
|
||||||
agentClient agent.Client,
|
|
||||||
egressLauncher rtc.EgressLauncher,
|
egressLauncher rtc.EgressLauncher,
|
||||||
topicFormatter rpc.TopicFormatter,
|
topicFormatter rpc.TopicFormatter,
|
||||||
roomClient rpc.TypedRoomClient,
|
roomClient rpc.TypedRoomClient,
|
||||||
@@ -64,7 +61,6 @@ func NewRoomService(
|
|||||||
router: router,
|
router: router,
|
||||||
roomAllocator: roomAllocator,
|
roomAllocator: roomAllocator,
|
||||||
roomStore: serviceStore,
|
roomStore: serviceStore,
|
||||||
agentClient: agentClient,
|
|
||||||
egressLauncher: egressLauncher,
|
egressLauncher: egressLauncher,
|
||||||
topicFormatter: topicFormatter,
|
topicFormatter: topicFormatter,
|
||||||
roomClient: roomClient,
|
roomClient: roomClient,
|
||||||
|
|||||||
@@ -115,7 +115,6 @@ func newTestRoomService(limitConf config.LimitConfig) *TestRoomService {
|
|||||||
allocator,
|
allocator,
|
||||||
store,
|
store,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
|
||||||
rpc.NewTopicFormatter(),
|
rpc.NewTopicFormatter(),
|
||||||
&rpcfakes.FakeTypedRoomClient{},
|
&rpcfakes.FakeTypedRoomClient{},
|
||||||
&rpcfakes.FakeTypedParticipantClient{},
|
&rpcfakes.FakeTypedParticipantClient{},
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import (
|
|||||||
"go.uber.org/atomic"
|
"go.uber.org/atomic"
|
||||||
"golang.org/x/exp/maps"
|
"golang.org/x/exp/maps"
|
||||||
|
|
||||||
"github.com/livekit/livekit-server/pkg/agent"
|
|
||||||
"github.com/livekit/livekit-server/pkg/config"
|
"github.com/livekit/livekit-server/pkg/config"
|
||||||
"github.com/livekit/livekit-server/pkg/routing"
|
"github.com/livekit/livekit-server/pkg/routing"
|
||||||
"github.com/livekit/livekit-server/pkg/routing/selector"
|
"github.com/livekit/livekit-server/pkg/routing/selector"
|
||||||
@@ -52,7 +51,6 @@ type RTCService struct {
|
|||||||
isDev bool
|
isDev bool
|
||||||
limits config.LimitConfig
|
limits config.LimitConfig
|
||||||
parser *uaparser.Parser
|
parser *uaparser.Parser
|
||||||
agentClient agent.Client
|
|
||||||
telemetry telemetry.TelemetryService
|
telemetry telemetry.TelemetryService
|
||||||
|
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
@@ -65,7 +63,6 @@ func NewRTCService(
|
|||||||
store ServiceStore,
|
store ServiceStore,
|
||||||
router routing.MessageRouter,
|
router routing.MessageRouter,
|
||||||
currentNode routing.LocalNode,
|
currentNode routing.LocalNode,
|
||||||
agentClient agent.Client,
|
|
||||||
telemetry telemetry.TelemetryService,
|
telemetry telemetry.TelemetryService,
|
||||||
) *RTCService {
|
) *RTCService {
|
||||||
s := &RTCService{
|
s := &RTCService{
|
||||||
@@ -78,7 +75,6 @@ func NewRTCService(
|
|||||||
isDev: conf.Development,
|
isDev: conf.Development,
|
||||||
limits: conf.Limit,
|
limits: conf.Limit,
|
||||||
parser: uaparser.NewFromSaved(),
|
parser: uaparser.NewFromSaved(),
|
||||||
agentClient: agentClient,
|
|
||||||
telemetry: telemetry,
|
telemetry: telemetry,
|
||||||
connections: map[*websocket.Conn]struct{}{},
|
connections: map[*websocket.Conn]struct{}{},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,10 +66,6 @@ func InitializeServer(conf *config.Config, currentNode routing.LocalNode) (*Live
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
client, err := agent.NewAgentClient(messageBus)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
egressClient, err := rpc.NewEgressClient(clientParams)
|
egressClient, err := rpc.NewEgressClient(clientParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -101,7 +97,7 @@ func InitializeServer(conf *config.Config, currentNode routing.LocalNode) (*Live
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
roomService, err := NewRoomService(limitConfig, apiConfig, router, roomAllocator, objectStore, client, rtcEgressLauncher, topicFormatter, roomClient, participantClient)
|
roomService, err := NewRoomService(limitConfig, apiConfig, router, roomAllocator, objectStore, rtcEgressLauncher, topicFormatter, roomClient, participantClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -123,12 +119,16 @@ func InitializeServer(conf *config.Config, currentNode routing.LocalNode) (*Live
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
sipService := NewSIPService(sipConfig, nodeID, messageBus, sipClient, sipStore, roomService, telemetryService)
|
sipService := NewSIPService(sipConfig, nodeID, messageBus, sipClient, sipStore, roomService, telemetryService)
|
||||||
rtcService := NewRTCService(conf, roomAllocator, objectStore, router, currentNode, client, telemetryService)
|
rtcService := NewRTCService(conf, roomAllocator, objectStore, router, currentNode, telemetryService)
|
||||||
agentService, err := NewAgentService(conf, currentNode, messageBus, keyProvider)
|
agentService, err := NewAgentService(conf, currentNode, messageBus, keyProvider)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
clientConfigurationManager := createClientConfiguration()
|
clientConfigurationManager := createClientConfiguration()
|
||||||
|
client, err := agent.NewAgentClient(messageBus)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
agentStore := getAgentStore(objectStore)
|
agentStore := getAgentStore(objectStore)
|
||||||
timedVersionGenerator := utils.NewDefaultTimedVersionGenerator()
|
timedVersionGenerator := utils.NewDefaultTimedVersionGenerator()
|
||||||
turnAuthHandler := NewTURNAuthHandler(keyProvider)
|
turnAuthHandler := NewTURNAuthHandler(keyProvider)
|
||||||
|
|||||||
@@ -555,13 +555,7 @@ func (c *RTCClient) sendRequest(msg *livekit.SignalRequest) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *RTCClient) SendIceCandidate(ic *webrtc.ICECandidate, target livekit.SignalTarget) error {
|
func (c *RTCClient) SendIceCandidate(ic *webrtc.ICECandidate, target livekit.SignalTarget) error {
|
||||||
var icQueue *atomic.Pointer[webrtc.ICECandidate]
|
prevIC := c.icQueue[target].Swap(ic)
|
||||||
if target == livekit.SignalTarget_PUBLISHER {
|
|
||||||
icQueue = &c.icQueue[0]
|
|
||||||
} else {
|
|
||||||
icQueue = &c.icQueue[1]
|
|
||||||
}
|
|
||||||
prevIC := icQueue.Swap(ic)
|
|
||||||
if prevIC == nil {
|
if prevIC == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user