config

package
v1.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const StreamKeyframeInterval = 4.0
View Source
const TmpDir = "/home/egress/tmp"

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioConfig added in v1.5.6

type AudioConfig struct {
	AudioEnabled     bool
	AudioTranscoding bool
	AudioOutCodec    types.MimeType
	AudioBitrate     int32
	AudioFrequency   int32
	AudioMixing      livekit.AudioMixing
}

type AudioTempoController added in v1.11.0

type AudioTempoController struct {
	Enabled        bool    `yaml:"enabled"`         // enable audio tempo adjustments for compensating PTS drift
	AdjustmentRate float64 `yaml:"adjustment_rate"` // rate at which to adjust the tempo to compensate for PTS drift
}

type BaseConfig added in v1.5.3

type BaseConfig struct {
	NodeID string // do not supply - will be overwritten

	// required
	Redis     *redis.RedisConfig `yaml:"redis"`      // redis config
	ApiKey    string             `yaml:"api_key"`    // (env LIVEKIT_API_KEY)
	ApiSecret string             `yaml:"api_secret"` // (env LIVEKIT_API_SECRET)
	WsUrl     string             `yaml:"ws_url"`     // (env LIVEKIT_WS_URL)

	// optional
	Logging                      *logger.Config `yaml:"logging"`                          // logging config
	TemplateBase                 string         `yaml:"template_base"`                    // custom template base url
	ClusterID                    string         `yaml:"cluster_id"`                       // cluster this instance belongs to
	EnableChromeSandbox          bool           `yaml:"enable_chrome_sandbox"`            // enable Chrome sandbox, requires extra docker configuration
	MaxUploadQueue               int            `yaml:"max_upload_queue"`                 // maximum upload queue size, in minutes
	DisallowLocalStorage         bool           `yaml:"disallow_local_storage"`           // require an upload config for all requests
	EnableRoomCompositeSDKSource bool           `yaml:"enable_room_composite_sdk_source"` // attempt to render supported audio only room composite use cases using the SDK source instead of Chrome. This option will be removed when this becomes the default behavior eventually.
	IOCreateTimeout              time.Duration  `yaml:"io_create_timeout"`                // timeout for CreateEgress calls
	IOUpdateTimeout              time.Duration  `yaml:"io_update_timeout"`                // timeout for UpdateEgress calls
	IOWorkers                    int            `yaml:"io_workers"`                       // number of IO update workers

	SessionLimits          `yaml:"session_limits"` // session duration limits
	StorageConfig          *StorageConfig          `yaml:"storage,omitempty"`          // storage config
	BackupConfig           *StorageConfig          `yaml:"backup,omitempty"`           // backup config, for storage failures
	S3AssumeRoleKey        string                  `yaml:"s3_assume_role_key"`         // if set, this key is used for S3 uploads to assume the role defined in the assume_role_arn field of the S3 config
	S3AssumeRoleSecret     string                  `yaml:"s3_assume_role_secret"`      // if set, this secret is used for S3 uploads to assume the role defined in the assume_role_arn field of the S3 config
	S3AssumeRoleArn        string                  `yaml:"s3_assume_role_arn"`         // if set, this arn is used by default for S3 uploads
	S3AssumeRoleExternalID string                  `yaml:"s3_assume_role_external_id"` // if set, this external ID is used by default for S3 uploads

	// advanced
	Insecure             bool                                `yaml:"insecure"`               // allow chrome to connect to an insecure websocket
	Debug                DebugConfig                         `yaml:"debug"`                  // create dot file on internal error
	ChromeFlags          map[string]interface{}              `yaml:"chrome_flags"`           // additional flags to pass to Chrome
	Latency              LatencyConfig                       `yaml:"latency"`                // gstreamer latencies, modifying these may break the service
	LatencyOverrides     map[types.RequestType]LatencyConfig `yaml:"latency_overrides"`      // latency overrides for different request types, experimental only, will be removed
	AudioTempoController AudioTempoController                `yaml:"audio_tempo_controller"` // audio tempo controller
}

type CPUCostConfig added in v1.0.4

type CPUCostConfig struct {
	MaxCpuUtilization         float64 `yaml:"max_cpu_utilization"` // maximum allowed CPU utilization when deciding to accept a request. Default to 80%
	MaxMemory                 float64 `yaml:"max_memory"`          // maximum allowed memory usage in GB. 0 to disable
	MemoryCost                float64 `yaml:"memory_cost"`         // minimum memory in GB
	RoomCompositeCpuCost      float64 `yaml:"room_composite_cpu_cost"`
	AudioRoomCompositeCpuCost float64 `yaml:"audio_room_composite_cpu_cost"`
	WebCpuCost                float64 `yaml:"web_cpu_cost"`
	AudioWebCpuCost           float64 `yaml:"audio_web_cpu_cost"`
	ParticipantCpuCost        float64 `yaml:"participant_cpu_cost"`
	TrackCompositeCpuCost     float64 `yaml:"track_composite_cpu_cost"`
	TrackCpuCost              float64 `yaml:"track_cpu_cost"`
	MaxPulseClients           int     `yaml:"max_pulse_clients"` // pulse client limit for launching chrome
}

type DebugConfig added in v1.7.5

type DebugConfig struct {
	EnableProfiling     bool             `yaml:"enable_profiling"`      // create dot file and pprof on internal error
	EnableTrackLogging  bool             `yaml:"enable_track_logging"`  // log packets and keyframes for each track
	EnableStreamLogging bool             `yaml:"enable_stream_logging"` // log bytes and keyframes for each stream
	EnableChromeLogging bool             `yaml:"enable_chrome_logging"` // log all chrome console events
	StorageConfig       `yaml:",inline"` // upload config (S3, Azure, GCP, or AliOSS)
}

type File added in v1.9.0

type File struct {
	Filename string `json:"filename,omitempty"`
	Location string `json:"location,omitempty"`
}

type FileConfig added in v1.7.1

type FileConfig struct {
	FileInfo        *livekit.FileInfo
	LocalFilepath   string
	StorageFilepath string

	DisableManifest bool
	StorageConfig   *StorageConfig
	// contains filtered or unexported fields
}

func (FileConfig) GetOutputType added in v1.7.1

func (o FileConfig) GetOutputType() types.OutputType

type Image added in v1.9.0

type Image struct {
	Filename  string    `json:"filename,omitempty"`
	Timestamp time.Time `json:"timestamp,omitempty"`
	Location  string    `json:"location,omitempty"`
}

type ImageConfig added in v1.7.13

type ImageConfig struct {
	Id string // Used internally to map a gst Bin/element back to a sink and as part of the path

	ImagesInfo     *livekit.ImagesInfo
	LocalDir       string
	StorageDir     string
	ImagePrefix    string
	ImageSuffix    livekit.ImageFileSuffix
	ImageExtension types.FileExtension

	DisableManifest bool
	StorageConfig   *StorageConfig

	CaptureInterval uint32
	Width           int32
	Height          int32
	ImageOutCodec   types.MimeType
	// contains filtered or unexported fields
}

func (ImageConfig) GetOutputType added in v1.7.13

func (o ImageConfig) GetOutputType() types.OutputType

type LatencyConfig added in v1.10.0

type LatencyConfig struct {
	JitterBufferLatency               time.Duration `yaml:"jitter_buffer_latency"`                            // jitter buffer max latency for sdk egress
	AudioMixerLatency                 time.Duration `yaml:"audio_mixer_latency"`                              // audio mixer latency, must be greater than jitter buffer latency
	PipelineLatency                   time.Duration `yaml:"pipeline_latency"`                                 // max latency for the entire pipeline
	RTPMaxAllowedTsDiff               time.Duration `ymal:"rtp_max_allowed_ts_diff"`                          // max allowed PTS discont. for a RTP stream, before applying PTS alignment
	RTPMaxDriftAdjustment             time.Duration `ymal:"rtp_max_drift_adjustment,omitempty"`               // max allowed drift adjustment for a RTP stream
	RTPDriftAdjustmentWindowPercent   float64       `ymal:"rtp_drift_adjustment_window_percent,omitempty"`    // how much to throttle drift adjustment, 0.0 disables it
	PreJitterBufferReceiveTimeEnabled bool          `yaml:"pre_jitter_buffer_receive_time_enabled,omitempty"` // use packet arrival time in synchronizer
	OldPacketThreshold                time.Duration `yaml:"old_packet_threshold,omitempty"`                   // syncrhonizer drops packets older than this, 0 to disable packet drops
	RTCPSenderReportRebaseEnabled     bool          `yaml:"rtcp_sender_report_rebase_enabled,omitempty"`      // synchronizer will rebase RTCP Sender Report to local clock
	PacketBurstEstimatorEnabled       bool          `yaml:"packet_burst_estimator_enabled,omitempty"`         // enable burst estimator for improving track synchronization
	EnablePipelineTimeFeedback        bool          `yaml:"enable_pipeline_time_feedback,omitempty"`          // enable pipeline time feedback for synchronizer
}

type Manifest added in v1.5.3

type Manifest struct {
	EgressID          string `json:"egress_id,omitempty"`
	RoomID            string `json:"room_id,omitempty"`
	RoomName          string `json:"room_name,omitempty"`
	Url               string `json:"url,omitempty"`
	StartedAt         int64  `json:"started_at,omitempty"`
	EndedAt           int64  `json:"ended_at,omitempty"`
	PublisherIdentity string `json:"publisher_identity,omitempty"`
	TrackID           string `json:"track_id,omitempty"`
	TrackKind         string `json:"track_kind,omitempty"`
	TrackSource       string `json:"track_source,omitempty"`
	AudioTrackID      string `json:"audio_track_id,omitempty"`
	VideoTrackID      string `json:"video_track_id,omitempty"`

	Files     []*File     `json:"files,omitempty"`
	Playlists []*Playlist `json:"playlists,omitempty"`
	Images    []*Image    `json:"images,omitempty"`
	// contains filtered or unexported fields
}

func (*Manifest) AddFile added in v1.9.0

func (m *Manifest) AddFile(filename, location string)

func (*Manifest) AddImage added in v1.9.0

func (m *Manifest) AddImage(filename string, ts time.Time, location string)

func (*Manifest) AddPlaylist added in v1.9.0

func (m *Manifest) AddPlaylist() *Playlist

func (*Manifest) Close added in v1.9.0

func (m *Manifest) Close(endedAt int64) ([]byte, error)

type OutputConfig added in v1.5.6

type OutputConfig interface {
	GetOutputType() types.OutputType
}

type PipelineConfig added in v1.5.3

type PipelineConfig struct {
	BaseConfig `yaml:",inline"`

	HandlerID string `yaml:"handler_id"`
	TmpDir    string `yaml:"tmp_dir"`

	types.RequestType `yaml:"-"`
	SourceConfig      `yaml:"-"`
	AudioConfig       `yaml:"-"`
	VideoConfig       `yaml:"-"`

	Outputs              map[types.EgressType][]OutputConfig `yaml:"-"`
	OutputCount          atomic.Int32                        `yaml:"-"`
	FinalizationRequired bool                                `yaml:"-"`

	Info     *livekit.EgressInfo `yaml:"-"`
	Manifest *Manifest           `yaml:"-"`
}

func GetValidatedPipelineConfig added in v1.5.3

func GetValidatedPipelineConfig(conf *ServiceConfig, req *rpc.StartEgressRequest) (*PipelineConfig, error)

func NewPipelineConfig added in v1.5.3

func NewPipelineConfig(confString string, req *rpc.StartEgressRequest) (*PipelineConfig, error)

func (*PipelineConfig) GetEncodedOutputs added in v1.7.13

func (p *PipelineConfig) GetEncodedOutputs() []OutputConfig

func (*PipelineConfig) GetFileConfig added in v1.7.1

func (p *PipelineConfig) GetFileConfig() *FileConfig

func (*PipelineConfig) GetImageConfigs added in v1.7.13

func (p *PipelineConfig) GetImageConfigs() []*ImageConfig

func (*PipelineConfig) GetSegmentConfig added in v1.7.1

func (p *PipelineConfig) GetSegmentConfig() *SegmentConfig

func (*PipelineConfig) GetStreamConfig added in v1.7.1

func (p *PipelineConfig) GetStreamConfig() *StreamConfig

func (*PipelineConfig) GetWebsocketConfig added in v1.7.1

func (p *PipelineConfig) GetWebsocketConfig() *StreamConfig

func (*PipelineConfig) Update added in v1.5.3

func (p *PipelineConfig) Update(request *rpc.StartEgressRequest) error

func (*PipelineConfig) UpdateInfoFromSDK added in v1.5.6

func (p *PipelineConfig) UpdateInfoFromSDK(identifier string, replacements map[string]string, w, h uint32) error

used for sdk input source

type Playlist added in v1.9.0

type Playlist struct {
	Location string     `json:"location,omitempty"`
	Segments []*Segment `json:"segments,omitempty"`
	// contains filtered or unexported fields
}

func (*Playlist) AddSegment added in v1.9.0

func (p *Playlist) AddSegment(filename, location string)

func (*Playlist) UpdateLocation added in v1.9.0

func (p *Playlist) UpdateLocation(location string)

type SDKSourceParams added in v1.5.6

type SDKSourceParams struct {
	TrackID      string
	AudioTrackID string
	VideoTrackID string
	Identity     string
	TrackSource  string
	TrackKind    string
	ScreenShare  bool
	AudioInCodec types.MimeType
	VideoInCodec types.MimeType
	AudioTracks  []*TrackSource
	VideoTrack   *TrackSource
}

type Segment added in v1.9.0

type Segment struct {
	Filename string `json:"filename,omitempty"`
	Location string `json:"location,omitempty"`
}

type SegmentConfig added in v1.7.1

type SegmentConfig struct {
	SegmentsInfo         *livekit.SegmentsInfo
	LocalDir             string
	StorageDir           string
	PlaylistFilename     string
	LivePlaylistFilename string
	SegmentPrefix        string
	SegmentSuffix        livekit.SegmentedFileSuffix
	SegmentDuration      int

	DisableManifest bool
	StorageConfig   *StorageConfig
	// contains filtered or unexported fields
}

func (SegmentConfig) GetOutputType added in v1.7.1

func (o SegmentConfig) GetOutputType() types.OutputType

type ServiceConfig added in v1.5.3

type ServiceConfig struct {
	BaseConfig `yaml:",inline"`

	HealthPort       int `yaml:"health_port"`        // health check port
	TemplatePort     int `yaml:"template_port"`      // room composite template server port
	PrometheusPort   int `yaml:"prometheus_port"`    // prometheus handler port
	DebugHandlerPort int `yaml:"debug_handler_port"` // egress debug handler port

	*CPUCostConfig `yaml:"cpu_cost"` // CPU costs for the different egress types
}

func NewServiceConfig added in v1.5.3

func NewServiceConfig(confString string) (*ServiceConfig, error)

func (*ServiceConfig) InitDefaults added in v1.9.0

func (c *ServiceConfig) InitDefaults()

type SessionLimits added in v1.2.0

type SessionLimits struct {
	FileOutputMaxDuration    time.Duration `yaml:"file_output_max_duration"`
	FileOutputMaxSize        int64         `yaml:"file_output_max_size"` // max on-disk size in bytes before stopping; 0 to disable
	StreamOutputMaxDuration  time.Duration `yaml:"stream_output_max_duration"`
	SegmentOutputMaxDuration time.Duration `yaml:"segment_output_max_duration"`
	ImageOutputMaxDuration   time.Duration `yaml:"image_output_max_duration"`
}

type SourceConfig added in v1.5.6

type SourceConfig struct {
	SourceType types.SourceType
	WebSourceParams
	SDKSourceParams
}

type StorageConfig added in v1.7.5

type StorageConfig struct {
	Prefix               string `yaml:"prefix"` // prefix applied to all filenames
	GeneratePresignedUrl bool   `yaml:"generate_presigned_url"`

	S3     *storage.S3Config     `yaml:"s3"`     // upload to s3
	Azure  *storage.AzureConfig  `yaml:"azure"`  // upload to azure
	GCP    *storage.GCPConfig    `yaml:"gcp"`    // upload to gcp
	AliOSS *storage.AliOSSConfig `yaml:"alioss"` // upload to aliyun
}

func (*StorageConfig) IsLocal added in v1.9.0

func (c *StorageConfig) IsLocal() bool

type Stream added in v1.8.6

type Stream struct {
	Name        string // gstreamer stream ID
	ParsedUrl   string // parsed/validated url
	RedactedUrl string // url with stream key removed
	StreamID    string // stream ID used by rtmpconnection
	StreamInfo  *livekit.StreamInfo
	// contains filtered or unexported fields
}

func (*Stream) ShouldSendRetryUpdate added in v1.12.0

func (s *Stream) ShouldSendRetryUpdate(now time.Time, minInterval time.Duration) bool

func (*Stream) UpdateEndTime added in v1.8.6

func (s *Stream) UpdateEndTime(endedAt int64)

type StreamConfig added in v1.7.1

type StreamConfig struct {

	// url -> Stream
	Streams sync.Map
	// contains filtered or unexported fields
}

func (*StreamConfig) AddStream added in v1.8.6

func (o *StreamConfig) AddStream(rawUrl string, outputType types.OutputType) (*Stream, error)

func (StreamConfig) GetOutputType added in v1.7.1

func (o StreamConfig) GetOutputType() types.OutputType

func (*StreamConfig) GetStream added in v1.8.6

func (o *StreamConfig) GetStream(rawUrl string) (*Stream, error)

func (*StreamConfig) ValidateUrl added in v1.8.6

func (o *StreamConfig) ValidateUrl(rawUrl string, outputType types.OutputType) (
	parsed string, redacted string, streamID string, err error,
)

type TrackSource added in v1.7.8

type TrackSource struct {
	TrackID            string
	TrackKind          lksdk.TrackKind
	ParticipantKind    lksdk.ParticipantKind
	AppSrc             *app.Source
	MimeType           types.MimeType
	PayloadType        webrtc.PayloadType
	ClockRate          uint32
	TempoController    *tempo.Controller
	OnKeyframeRequired func()
}

type VideoConfig added in v1.5.6

type VideoConfig struct {
	VideoEnabled     bool
	VideoDecoding    bool
	VideoEncoding    bool
	VideoOutCodec    types.MimeType
	VideoProfile     types.Profile
	Width            int32
	Height           int32
	Depth            int32
	Framerate        int32
	VideoBitrate     int32
	KeyFrameInterval float64
}

type WebSourceParams added in v1.5.6

type WebSourceParams struct {
	AwaitStartSignal bool
	Display          string
	Layout           string
	Token            string
	BaseUrl          string
	WebUrl           string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL