diff --git a/README.md b/README.md index ae5647c2..5466e5ae 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,8 @@ rtmp_port: port to listen to incoming RTMP connection on (default 1935) whip_port: port to listen to incoming WHIP calls on (default 8080) http_relay_port: port used to relay data from the main service process to the per ingress handler process (default 9090) rtc_config: configuration for ICE and other RTC related settings, same settings livekit-server RTC configuration. Used for WHIP. +enable_udp_url_pull: allow URL pull ingresses to pull from udp:// urls (default false) +multicast_interface: network interface to join multicast groups on for UDP url pull. Empty lets the OS decide # cpu costs for various Ingress types with their default values cpu_cost: diff --git a/pkg/config/config.go b/pkg/config/config.go index 15bba80d..2bbf2f38 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -61,6 +61,9 @@ type ServiceConfig struct { Logging logger.Config `yaml:"logging"` Development bool `yaml:"development"` PSRPCSkipClaim bool `yaml:"psrpc_skip_claim,omitempty"` // Lets psrpc servers skip the claim handshake on queue rpcs + EnableUDPURLPull bool `yaml:"enable_udp_url_pull,omitempty"` + // Network interface to join multicast groups on for UDP url pull. Empty means let the OS decide. + MulticastInterface string `yaml:"multicast_interface,omitempty"` // Used for WHIP transport RTCConfig rtcconfig.RTCConfig `yaml:"rtc_config"` diff --git a/pkg/media/urlpull/source.go b/pkg/media/urlpull/source.go index 867db5de..b676ca11 100644 --- a/pkg/media/urlpull/source.go +++ b/pkg/media/urlpull/source.go @@ -22,9 +22,10 @@ import ( "github.com/frostbyte73/core" "github.com/go-gst/go-gst/gst" + "github.com/livekit/protocol/logger" + "github.com/livekit/ingress/pkg/errors" "github.com/livekit/ingress/pkg/params" - "github.com/livekit/protocol/logger" ) var ( @@ -85,6 +86,24 @@ func NewURLSource(_ context.Context, p *params.Params) (*URLSource, error) { } } } + } else if p.EnableUDPURLPull && strings.HasPrefix(p.Url, "udp://") { + elem, err = gst.NewElement("udpsrc") + if err != nil { + return nil, err + } + err = elem.SetProperty("uri", p.Url) + if err != nil { + return nil, err + } + + if p.MulticastInterface != "" { + err = elem.SetProperty("multicast-iface", p.MulticastInterface) + if err != nil { + return nil, err + } + } + + // udpsrc doesn't expose a stats property, so leave printStats unset } else { return nil, errors.ErrUnsupportedURLFormat }