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.
This commit is contained in:
Zac Gaetano 2026-04-17 09:50:28 -04:00
parent c38036de94
commit eaeefee753

View file

@ -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))