From 4d94c88d744373e034c9a2714111d24d50f415b2 Mon Sep 17 00:00:00 2001 From: ZGaetano Date: Sat, 9 May 2026 17:01:49 -0400 Subject: [PATCH] Add ProcessConfigWHIPIngest to API layer with Marshal/Unmarshal wiring 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. --- http/api/process.go | 45 +++++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/http/api/process.go b/http/api/process.go index 5a4e115..2486dbf 100644 --- a/http/api/process.go +++ b/http/api/process.go @@ -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