Some golang modernisation bits. (#4016)
Mainly doing this to check CI static check failures.
This commit is contained in:
@@ -1006,9 +1006,10 @@ func (r *RoomManager) iceServersForParticipant(apiKey string, participant types.
|
|||||||
for _, s := range r.config.RTC.TURNServers {
|
for _, s := range r.config.RTC.TURNServers {
|
||||||
scheme := "turn"
|
scheme := "turn"
|
||||||
transport := "tcp"
|
transport := "tcp"
|
||||||
if s.Protocol == "tls" {
|
switch s.Protocol {
|
||||||
|
case "tls":
|
||||||
scheme = "turns"
|
scheme = "turns"
|
||||||
} else if s.Protocol == "udp" {
|
case "udp":
|
||||||
transport = "udp"
|
transport = "udp"
|
||||||
}
|
}
|
||||||
is := &livekit.ICEServer{
|
is := &livekit.ICEServer{
|
||||||
|
|||||||
@@ -89,23 +89,23 @@ func InitializeServer(conf *config.Config, currentNode routing.LocalNode) (*Live
|
|||||||
}
|
}
|
||||||
rtcEgressLauncher := NewEgressLauncher(egressClient, ioInfoService, objectStore)
|
rtcEgressLauncher := NewEgressLauncher(egressClient, ioInfoService, objectStore)
|
||||||
topicFormatter := rpc.NewTopicFormatter()
|
topicFormatter := rpc.NewTopicFormatter()
|
||||||
roomClient, err := rpc.NewTypedRoomClient(clientParams)
|
v, err := rpc.NewTypedRoomClient(clientParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
participantClient, err := rpc.NewTypedParticipantClient(clientParams)
|
v2, err := rpc.NewTypedParticipantClient(clientParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
roomService, err := NewRoomService(limitConfig, apiConfig, router, roomAllocator, objectStore, rtcEgressLauncher, topicFormatter, roomClient, participantClient)
|
roomService, err := NewRoomService(limitConfig, apiConfig, router, roomAllocator, objectStore, rtcEgressLauncher, topicFormatter, v, v2)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
agentDispatchInternalClient, err := rpc.NewTypedAgentDispatchInternalClient(clientParams)
|
v3, err := rpc.NewTypedAgentDispatchInternalClient(clientParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
agentDispatchService := NewAgentDispatchService(agentDispatchInternalClient, topicFormatter, roomAllocator, router)
|
agentDispatchService := NewAgentDispatchService(v3, topicFormatter, roomAllocator, router)
|
||||||
egressService := NewEgressService(egressClient, rtcEgressLauncher, ioInfoService, roomService)
|
egressService := NewEgressService(egressClient, rtcEgressLauncher, ioInfoService, roomService)
|
||||||
ingressConfig := getIngressConfig(conf)
|
ingressConfig := getIngressConfig(conf)
|
||||||
ingressClient, err := rpc.NewIngressClient(clientParams)
|
ingressClient, err := rpc.NewIngressClient(clientParams)
|
||||||
@@ -120,11 +120,11 @@ func InitializeServer(conf *config.Config, currentNode routing.LocalNode) (*Live
|
|||||||
}
|
}
|
||||||
sipService := NewSIPService(sipConfig, nodeID, messageBus, sipClient, sipStore, roomService, telemetryService)
|
sipService := NewSIPService(sipConfig, nodeID, messageBus, sipClient, sipStore, roomService, telemetryService)
|
||||||
rtcService := NewRTCService(conf, roomAllocator, router, telemetryService)
|
rtcService := NewRTCService(conf, roomAllocator, router, telemetryService)
|
||||||
whipParticipantClient, err := rpc.NewTypedWHIPParticipantClient(clientParams)
|
v4, err := rpc.NewTypedWHIPParticipantClient(clientParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
serviceWHIPService, err := NewWHIPService(conf, router, roomAllocator, clientParams, topicFormatter, whipParticipantClient)
|
serviceWHIPService, err := NewWHIPService(conf, router, roomAllocator, clientParams, topicFormatter, v4)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -604,14 +604,10 @@ func (f *Forwarder) GetMaxSubscribedSpatial() int32 {
|
|||||||
|
|
||||||
layer := buffer.InvalidLayerSpatial // covers muted case
|
layer := buffer.InvalidLayerSpatial // covers muted case
|
||||||
if !f.muted {
|
if !f.muted {
|
||||||
layer = f.vls.GetMax().Spatial
|
|
||||||
|
|
||||||
// If current is higher, mark the current layer as max subscribed layer
|
// If current is higher, mark the current layer as max subscribed layer
|
||||||
// to prevent the current layer from stopping before forwarder switches
|
// to prevent the current layer from stopping before forwarder switches
|
||||||
// to the new and lower max layer,
|
// to the new and lower max layer,
|
||||||
if layer < f.vls.GetCurrent().Spatial {
|
layer = max(f.vls.GetMax().Spatial, f.vls.GetCurrent().Spatial)
|
||||||
layer = f.vls.GetCurrent().Spatial
|
|
||||||
}
|
|
||||||
|
|
||||||
// if reference layer is higher, hold there until an RTCP Sender Report from
|
// if reference layer is higher, hold there until an RTCP Sender Report from
|
||||||
// publisher is available as that is used for reference time stamp between layers.
|
// publisher is available as that is used for reference time stamp between layers.
|
||||||
@@ -1605,7 +1601,7 @@ func (f *Forwarder) Restart() {
|
|||||||
f.referenceLayerSpatial = buffer.InvalidLayerSpatial
|
f.referenceLayerSpatial = buffer.InvalidLayerSpatial
|
||||||
f.lastReferencePayloadType = -1
|
f.lastReferencePayloadType = -1
|
||||||
|
|
||||||
for layer := 0; layer < len(f.refInfos); layer++ {
|
for layer := range len(f.refInfos) {
|
||||||
f.refInfos[layer] = refInfo{}
|
f.refInfos[layer] = refInfo{}
|
||||||
}
|
}
|
||||||
f.lastSwitchExtIncomingTS = 0
|
f.lastSwitchExtIncomingTS = 0
|
||||||
@@ -1633,7 +1629,7 @@ func (f *Forwarder) FilterRTX(nacks []uint16) (filtered []uint16, disallowedLaye
|
|||||||
if FlagFilterRTXLayers {
|
if FlagFilterRTXLayers {
|
||||||
currentLayer := f.vls.GetCurrent()
|
currentLayer := f.vls.GetCurrent()
|
||||||
targetLayer := f.vls.GetTarget()
|
targetLayer := f.vls.GetTarget()
|
||||||
for layer := int32(0); layer < buffer.DefaultMaxLayerSpatial+1; layer++ {
|
for layer := range buffer.DefaultMaxLayerSpatial + 1 {
|
||||||
if f.isDeficientLocked() && (targetLayer.Spatial < currentLayer.Spatial || layer > currentLayer.Spatial) {
|
if f.isDeficientLocked() && (targetLayer.Spatial < currentLayer.Spatial || layer > currentLayer.Spatial) {
|
||||||
disallowedLayers[layer] = true
|
disallowedLayers[layer] = true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user