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.
This commit is contained in:
parent
4ac63ddfc6
commit
4d94c88d74
1 changed files with 31 additions and 14 deletions
|
|
@ -42,7 +42,7 @@ type ProcessConfigLimits struct {
|
||||||
WaitFor uint64 `json:"waitfor_seconds" jsonschema:"minimum=0" format:"uint64"`
|
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 {
|
type ProcessConfigWebRTC struct {
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
VideoPT uint8 `json:"video_pt,omitempty"`
|
VideoPT uint8 `json:"video_pt,omitempty"`
|
||||||
|
|
@ -52,19 +52,27 @@ type ProcessConfigWebRTC struct {
|
||||||
AudioMap string `json:"audio_map,omitempty"`
|
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 {
|
type ProcessConfig struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Type string `json:"type" validate:"oneof='ffmpeg' ''" jsonschema:"enum=ffmpeg,enum="`
|
Type string `json:"type" validate:"oneof='ffmpeg' ''" jsonschema:"enum=ffmpeg,enum="`
|
||||||
Reference string `json:"reference"`
|
Reference string `json:"reference"`
|
||||||
Input []ProcessConfigIO `json:"input" validate:"required"`
|
Input []ProcessConfigIO `json:"input" validate:"required"`
|
||||||
Output []ProcessConfigIO `json:"output" validate:"required"`
|
Output []ProcessConfigIO `json:"output" validate:"required"`
|
||||||
Options []string `json:"options"`
|
Options []string `json:"options"`
|
||||||
Reconnect bool `json:"reconnect"`
|
Reconnect bool `json:"reconnect"`
|
||||||
ReconnectDelay uint64 `json:"reconnect_delay_seconds" format:"uint64"`
|
ReconnectDelay uint64 `json:"reconnect_delay_seconds" format:"uint64"`
|
||||||
Autostart bool `json:"autostart"`
|
Autostart bool `json:"autostart"`
|
||||||
StaleTimeout uint64 `json:"stale_timeout_seconds" format:"uint64"`
|
StaleTimeout uint64 `json:"stale_timeout_seconds" format:"uint64"`
|
||||||
Limits ProcessConfigLimits `json:"limits"`
|
Limits ProcessConfigLimits `json:"limits"`
|
||||||
WebRTC ProcessConfigWebRTC `json:"webrtc"`
|
WebRTC ProcessConfigWebRTC `json:"webrtc"`
|
||||||
|
WHIPIngest ProcessConfigWHIPIngest `json:"whip_ingest"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal converts a process config in API representation to a restreamer process config
|
// 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,
|
VideoMap: cfg.WebRTC.VideoMap,
|
||||||
AudioMap: cfg.WebRTC.AudioMap,
|
AudioMap: cfg.WebRTC.AudioMap,
|
||||||
},
|
},
|
||||||
|
WHIPIngest: app.ConfigWHIPIngest{
|
||||||
|
Enabled: cfg.WHIPIngest.Enabled,
|
||||||
|
VideoPT: cfg.WHIPIngest.VideoPT,
|
||||||
|
AudioPT: cfg.WHIPIngest.AudioPT,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg.generateInputOutputIDs(cfg.Input)
|
cfg.generateInputOutputIDs(cfg.Input)
|
||||||
|
|
@ -175,6 +188,10 @@ func (cfg *ProcessConfig) Unmarshal(c *app.Config) {
|
||||||
cfg.WebRTC.VideoMap = c.WebRTC.VideoMap
|
cfg.WebRTC.VideoMap = c.WebRTC.VideoMap
|
||||||
cfg.WebRTC.AudioMap = c.WebRTC.AudioMap
|
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))
|
cfg.Options = make([]string, len(c.Options))
|
||||||
copy(cfg.Options, c.Options)
|
copy(cfg.Options, c.Options)
|
||||||
|
|
||||||
|
|
@ -225,7 +242,7 @@ type ProcessReport struct {
|
||||||
History []ProcessReportHistoryEntry `json:"history"`
|
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) {
|
func (report *ProcessReport) Unmarshal(l *app.Log) {
|
||||||
if l == nil {
|
if l == nil {
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue