From eaeefee7533c53af002d71aadbbb30a937775937 Mon Sep 17 00:00:00 2001 From: Zac Gaetano Date: Fri, 17 Apr 2026 09:50:28 -0400 Subject: [PATCH] feat(restream): add ConfigWebRTC per-process field Adds the per-process WebRTC egress toggle + codec/payload-type knobs described in the M2 spec. Clone() carries it forward. No behavior change yet \u2014 the subsystem wiring comes later in M2. --- restream/app/process.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/restream/app/process.go b/restream/app/process.go index 5e301c3..4791871 100644 --- a/restream/app/process.go +++ b/restream/app/process.go @@ -18,6 +18,23 @@ type ConfigIO struct { Cleanup []ConfigIOCleanup `json:"cleanup"` } +// ConfigWebRTC carries per-process WebRTC egress settings. +// +// When Enabled is true the restream manager will (via the app/webrtc +// subsystem) append an additional FFmpeg output leg that emits H.264/Opus +// RTP to a loopback UDP port the subsystem allocates. The subsystem reads +// that RTP and fans it out to WHEP subscribers. +type ConfigWebRTC struct { + Enabled bool `json:"enabled"` + VideoPT uint8 `json:"video_pt"` + AudioPT uint8 `json:"audio_pt"` + ForceTranscode bool `json:"force_transcode"` +} + +// Clone returns a deep copy of the WebRTC config (currently a value copy; +// provided for symmetry with other Clone methods and future-proofing). +func (w ConfigWebRTC) Clone() ConfigWebRTC { return w } + func (io ConfigIO) Clone() ConfigIO { clone := ConfigIO{ ID: io.ID, @@ -47,6 +64,7 @@ type Config struct { LimitCPU float64 `json:"limit_cpu_usage"` // percent LimitMemory uint64 `json:"limit_memory_bytes"` // bytes LimitWaitFor uint64 `json:"limit_waitfor_seconds"` // seconds + WebRTC ConfigWebRTC `json:"webrtc"` } func (config *Config) Clone() *Config { @@ -61,6 +79,7 @@ func (config *Config) Clone() *Config { LimitCPU: config.LimitCPU, LimitMemory: config.LimitMemory, LimitWaitFor: config.LimitWaitFor, + WebRTC: config.WebRTC.Clone(), } clone.Input = make([]ConfigIO, len(config.Input))