@@ -39,6 +39,14 @@ rtc:
|
|||||||
# # by default LiveKit clients use Google's public STUN servers
|
# # by default LiveKit clients use Google's public STUN servers
|
||||||
# stun_servers:
|
# stun_servers:
|
||||||
# - server1
|
# - server1
|
||||||
|
# # optional TURN servers for clients. This isn't necessary if using embedded TURN server (see below).
|
||||||
|
# turn_servers:
|
||||||
|
# - host: myhost.com
|
||||||
|
# port: 443
|
||||||
|
# # tls, tcp, or udp
|
||||||
|
# protocol: tls
|
||||||
|
# username: ""
|
||||||
|
# credential: ""
|
||||||
# # allows LiveKit to monitor congestion when sending streams and automatically
|
# # allows LiveKit to monitor congestion when sending streams and automatically
|
||||||
# # manage bandwidth utilization to avoid congestion/loss. Enabled by default
|
# # manage bandwidth utilization to avoid congestion/loss. Enabled by default
|
||||||
# congestion_control:
|
# congestion_control:
|
||||||
|
|||||||
+18
-8
@@ -46,14 +46,16 @@ type Config struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RTCConfig struct {
|
type RTCConfig struct {
|
||||||
UDPPort uint32 `yaml:"udp_port,omitempty"`
|
UDPPort uint32 `yaml:"udp_port,omitempty"`
|
||||||
TCPPort uint32 `yaml:"tcp_port,omitempty"`
|
TCPPort uint32 `yaml:"tcp_port,omitempty"`
|
||||||
ICEPortRangeStart uint32 `yaml:"port_range_start,omitempty"`
|
ICEPortRangeStart uint32 `yaml:"port_range_start,omitempty"`
|
||||||
ICEPortRangeEnd uint32 `yaml:"port_range_end,omitempty"`
|
ICEPortRangeEnd uint32 `yaml:"port_range_end,omitempty"`
|
||||||
NodeIP string `yaml:"node_ip,omitempty"`
|
NodeIP string `yaml:"node_ip,omitempty"`
|
||||||
STUNServers []string `yaml:"stun_servers,omitempty"`
|
STUNServers []string `yaml:"stun_servers,omitempty"`
|
||||||
UseExternalIP bool `yaml:"use_external_ip"`
|
TURNServers []TURNServer `yaml:"turn_servers,omitempty"`
|
||||||
UseICELite bool `yaml:"use_ice_lite,omitempty"`
|
UseExternalIP bool `yaml:"use_external_ip"`
|
||||||
|
UseICELite bool `yaml:"use_ice_lite,omitempty"`
|
||||||
|
|
||||||
// Number of packets to buffer for NACK
|
// Number of packets to buffer for NACK
|
||||||
PacketBufferSize int `yaml:"packet_buffer_size,omitempty"`
|
PacketBufferSize int `yaml:"packet_buffer_size,omitempty"`
|
||||||
|
|
||||||
@@ -71,6 +73,14 @@ type RTCConfig struct {
|
|||||||
ForceTCP bool `yaml:"force_tcp,omitempty"`
|
ForceTCP bool `yaml:"force_tcp,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type TURNServer struct {
|
||||||
|
Host string `yaml:"host"`
|
||||||
|
Port int `yaml:"port"`
|
||||||
|
Protocol string `yaml:"protocol"`
|
||||||
|
Username string `yaml:"username,omitempty"`
|
||||||
|
Credential string `yaml:"credential,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type PLIThrottleConfig struct {
|
type PLIThrottleConfig struct {
|
||||||
LowQuality time.Duration `yaml:"low_quality,omitempty"`
|
LowQuality time.Duration `yaml:"low_quality,omitempty"`
|
||||||
MidQuality time.Duration `yaml:"mid_quality,omitempty"`
|
MidQuality time.Duration `yaml:"mid_quality,omitempty"`
|
||||||
|
|||||||
@@ -494,6 +494,7 @@ func (r *RoomManager) handleRTCMessage(_ context.Context, roomName livekit.RoomN
|
|||||||
|
|
||||||
func (r *RoomManager) iceServersForRoom(ri *livekit.Room) []*livekit.ICEServer {
|
func (r *RoomManager) iceServersForRoom(ri *livekit.Room) []*livekit.ICEServer {
|
||||||
var iceServers []*livekit.ICEServer
|
var iceServers []*livekit.ICEServer
|
||||||
|
rtcConf := r.config.RTC
|
||||||
|
|
||||||
hasSTUN := false
|
hasSTUN := false
|
||||||
if r.config.TURN.Enabled {
|
if r.config.TURN.Enabled {
|
||||||
@@ -515,7 +516,28 @@ func (r *RoomManager) iceServersForRoom(ri *livekit.Room) []*livekit.ICEServer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(r.config.RTC.STUNServers) > 0 {
|
if len(rtcConf.TURNServers) > 0 {
|
||||||
|
hasSTUN = true
|
||||||
|
for _, s := range r.config.RTC.TURNServers {
|
||||||
|
scheme := "turn"
|
||||||
|
transport := "tcp"
|
||||||
|
if s.Protocol == "tls" {
|
||||||
|
scheme = "turns"
|
||||||
|
} else if s.Protocol == "udp" {
|
||||||
|
transport = "udp"
|
||||||
|
}
|
||||||
|
is := &livekit.ICEServer{
|
||||||
|
Urls: []string{
|
||||||
|
fmt.Sprintf("%s:%s:%d?transport=%s", scheme, s.Host, s.Port, transport),
|
||||||
|
},
|
||||||
|
Username: s.Username,
|
||||||
|
Credential: s.Credential,
|
||||||
|
}
|
||||||
|
iceServers = append(iceServers, is)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(rtcConf.STUNServers) > 0 {
|
||||||
hasSTUN = true
|
hasSTUN = true
|
||||||
iceServers = append(iceServers, iceServerForStunServers(r.config.RTC.STUNServers))
|
iceServers = append(iceServers, iceServerForStunServers(r.config.RTC.STUNServers))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user