Add ProcessConfigWHIPIngest to API layer with Marshal/Unmarshal wiring
Some checks failed
ci / vet + build (push) Failing after 5m1s
ci / race tests (push) Has been skipped
ci / WebRTC smoke (5-viewer fanout) (push) Has been skipped
ci / WebRTC latency p95 gate (push) Has been skipped

Adds ProcessConfigWHIPIngest struct to http/api/process.go and wires it
into ProcessConfig.Marshal() and ProcessConfig.Unmarshal() so that the
WHIPIngest.Enabled flag can be set via API and correctly propagates to
app.Config.WHIPIngest, which is checked by onWHIPProcessStart in
app/webrtc/whip_lifecycle.go.

Without this change, app.Config.WHIPIngest.Enabled was always false and
WHIP ingest could never activate regardless of what the UI sent.
This commit is contained in:
Zac Gaetano 2026-05-09 17:01:49 -04:00
parent 4ac63ddfc6
commit 4d94c88d74

View file

@ -42,7 +42,7 @@ type ProcessConfigLimits struct {
WaitFor uint64 `json:"waitfor_seconds" jsonschema:"minimum=0" format:"uint64"`
}
// ProcessConfig represents the configuration of an ffmpeg process
// ProcessConfigWebRTC represents the WHEP (egress) WebRTC configuration for a process
type ProcessConfigWebRTC struct {
Enabled bool `json:"enabled"`
VideoPT uint8 `json:"video_pt,omitempty"`
@ -52,19 +52,27 @@ type ProcessConfigWebRTC struct {
AudioMap string `json:"audio_map,omitempty"`
}
// ProcessConfigWHIPIngest represents the WHIP (ingest) WebRTC configuration for a process
type ProcessConfigWHIPIngest struct {
Enabled bool `json:"enabled"`
VideoPT uint8 `json:"video_pt,omitempty"`
AudioPT uint8 `json:"audio_pt,omitempty"`
}
type ProcessConfig struct {
ID string `json:"id"`
Type string `json:"type" validate:"oneof='ffmpeg' ''" jsonschema:"enum=ffmpeg,enum="`
Reference string `json:"reference"`
Input []ProcessConfigIO `json:"input" validate:"required"`
Output []ProcessConfigIO `json:"output" validate:"required"`
Options []string `json:"options"`
Reconnect bool `json:"reconnect"`
ReconnectDelay uint64 `json:"reconnect_delay_seconds" format:"uint64"`
Autostart bool `json:"autostart"`
StaleTimeout uint64 `json:"stale_timeout_seconds" format:"uint64"`
Limits ProcessConfigLimits `json:"limits"`
WebRTC ProcessConfigWebRTC `json:"webrtc"`
ID string `json:"id"`
Type string `json:"type" validate:"oneof='ffmpeg' ''" jsonschema:"enum=ffmpeg,enum="`
Reference string `json:"reference"`
Input []ProcessConfigIO `json:"input" validate:"required"`
Output []ProcessConfigIO `json:"output" validate:"required"`
Options []string `json:"options"`
Reconnect bool `json:"reconnect"`
ReconnectDelay uint64 `json:"reconnect_delay_seconds" format:"uint64"`
Autostart bool `json:"autostart"`
StaleTimeout uint64 `json:"stale_timeout_seconds" format:"uint64"`
Limits ProcessConfigLimits `json:"limits"`
WebRTC ProcessConfigWebRTC `json:"webrtc"`
WHIPIngest ProcessConfigWHIPIngest `json:"whip_ingest"`
}
// Marshal converts a process config in API representation to a restreamer process config
@ -88,6 +96,11 @@ func (cfg *ProcessConfig) Marshal() *app.Config {
VideoMap: cfg.WebRTC.VideoMap,
AudioMap: cfg.WebRTC.AudioMap,
},
WHIPIngest: app.ConfigWHIPIngest{
Enabled: cfg.WHIPIngest.Enabled,
VideoPT: cfg.WHIPIngest.VideoPT,
AudioPT: cfg.WHIPIngest.AudioPT,
},
}
cfg.generateInputOutputIDs(cfg.Input)
@ -175,6 +188,10 @@ func (cfg *ProcessConfig) Unmarshal(c *app.Config) {
cfg.WebRTC.VideoMap = c.WebRTC.VideoMap
cfg.WebRTC.AudioMap = c.WebRTC.AudioMap
cfg.WHIPIngest.Enabled = c.WHIPIngest.Enabled
cfg.WHIPIngest.VideoPT = c.WHIPIngest.VideoPT
cfg.WHIPIngest.AudioPT = c.WHIPIngest.AudioPT
cfg.Options = make([]string, len(c.Options))
copy(cfg.Options, c.Options)
@ -225,7 +242,7 @@ type ProcessReport struct {
History []ProcessReportHistoryEntry `json:"history"`
}
// Unmarshal converts a restream log to a report
// Unmarshal converts a restreamer log to a report
func (report *ProcessReport) Unmarshal(l *app.Log) {
if l == nil {
return