Client configuration (#452)
* client configuration * fix init roommanager
This commit is contained in:
+19
-12
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/livekit/protocol/logger"
|
||||
"github.com/livekit/protocol/utils"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/clientconfiguration"
|
||||
"github.com/livekit/livekit-server/pkg/config"
|
||||
"github.com/livekit/livekit-server/pkg/routing"
|
||||
"github.com/livekit/livekit-server/pkg/rtc"
|
||||
@@ -29,12 +30,13 @@ const (
|
||||
type RoomManager struct {
|
||||
lock sync.RWMutex
|
||||
|
||||
config *config.Config
|
||||
rtcConfig *rtc.WebRTCConfig
|
||||
currentNode routing.LocalNode
|
||||
router routing.Router
|
||||
roomStore ObjectStore
|
||||
telemetry telemetry.TelemetryService
|
||||
config *config.Config
|
||||
rtcConfig *rtc.WebRTCConfig
|
||||
currentNode routing.LocalNode
|
||||
router routing.Router
|
||||
roomStore ObjectStore
|
||||
telemetry telemetry.TelemetryService
|
||||
clientConfManager clientconfiguration.ClientConfigurationManager
|
||||
|
||||
rooms map[livekit.RoomName]*rtc.Room
|
||||
}
|
||||
@@ -45,6 +47,7 @@ func NewLocalRoomManager(
|
||||
currentNode routing.LocalNode,
|
||||
router routing.Router,
|
||||
telemetry telemetry.TelemetryService,
|
||||
clientConfManager clientconfiguration.ClientConfigurationManager,
|
||||
) (*RoomManager, error) {
|
||||
|
||||
rtcConf, err := rtc.NewWebRTCConfig(conf, currentNode.Ip)
|
||||
@@ -53,12 +56,13 @@ func NewLocalRoomManager(
|
||||
}
|
||||
|
||||
r := &RoomManager{
|
||||
config: conf,
|
||||
rtcConfig: rtcConf,
|
||||
currentNode: currentNode,
|
||||
router: router,
|
||||
roomStore: roomStore,
|
||||
telemetry: telemetry,
|
||||
config: conf,
|
||||
rtcConfig: rtcConf,
|
||||
currentNode: currentNode,
|
||||
router: router,
|
||||
roomStore: roomStore,
|
||||
telemetry: telemetry,
|
||||
clientConfManager: clientConfManager,
|
||||
|
||||
rooms: make(map[livekit.RoomName]*rtc.Room),
|
||||
}
|
||||
@@ -228,6 +232,8 @@ func (r *RoomManager) StartSession(ctx context.Context, roomName livekit.RoomNam
|
||||
"protocol", pi.Client.Protocol,
|
||||
)
|
||||
|
||||
clientConf := r.clientConfManager.GetConfiguration(pi.Client)
|
||||
|
||||
pv := types.ProtocolVersion(pi.Client.Protocol)
|
||||
rtcConf := *r.rtcConfig
|
||||
rtcConf.SetBufferFactory(room.GetBufferFactory())
|
||||
@@ -248,6 +254,7 @@ func (r *RoomManager) StartSession(ctx context.Context, roomName livekit.RoomNam
|
||||
Grants: pi.Grants,
|
||||
Hidden: pi.Hidden,
|
||||
Logger: pLogger,
|
||||
ClientConf: clientConf,
|
||||
}, pi.Permission)
|
||||
if err != nil {
|
||||
logger.Errorw("could not create participant", err)
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
"github.com/google/wire"
|
||||
"github.com/livekit/livekit-server/pkg/clientconfiguration"
|
||||
"github.com/livekit/protocol/auth"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/livekit/protocol/logger"
|
||||
@@ -33,6 +34,7 @@ func InitializeServer(conf *config.Config, currentNode routing.LocalNode) (*Live
|
||||
wire.Bind(new(EgressStore), new(ObjectStore)),
|
||||
createKeyProvider,
|
||||
createWebhookNotifier,
|
||||
createClientConfiguration,
|
||||
routing.CreateRouter,
|
||||
wire.Bind(new(routing.MessageRouter), new(routing.Router)),
|
||||
wire.Bind(new(livekit.RoomService), new(*RoomService)),
|
||||
@@ -147,3 +149,7 @@ func createStore(rc *redis.Client) ObjectStore {
|
||||
}
|
||||
return NewLocalStore()
|
||||
}
|
||||
|
||||
func createClientConfiguration() clientconfiguration.ClientConfigurationManager {
|
||||
return clientconfiguration.NewStaticClientConfigurationManager(clientconfiguration.StaticConfigurations)
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"github.com/go-redis/redis/v8"
|
||||
"github.com/livekit/livekit-server/pkg/clientconfiguration"
|
||||
"github.com/livekit/livekit-server/pkg/config"
|
||||
"github.com/livekit/livekit-server/pkg/routing"
|
||||
"github.com/livekit/livekit-server/pkg/telemetry"
|
||||
@@ -54,7 +55,8 @@ func InitializeServer(conf *config.Config, currentNode routing.LocalNode) (*Live
|
||||
egressService := NewEgressService(messageBus, objectStore, roomService, telemetryService)
|
||||
recordingService := NewRecordingService(messageBus, telemetryService)
|
||||
rtcService := NewRTCService(conf, roomAllocator, objectStore, router, currentNode)
|
||||
roomManager, err := NewLocalRoomManager(conf, objectStore, currentNode, router, telemetryService)
|
||||
clientConfigurationManager := createClientConfiguration()
|
||||
roomManager, err := NewLocalRoomManager(conf, objectStore, currentNode, router, telemetryService, clientConfigurationManager)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -167,3 +169,7 @@ func createStore(rc *redis.Client) ObjectStore {
|
||||
}
|
||||
return NewLocalStore()
|
||||
}
|
||||
|
||||
func createClientConfiguration() clientconfiguration.ClientConfigurationManager {
|
||||
return clientconfiguration.NewStaticClientConfigurationManager(clientconfiguration.StaticConfigurations)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user