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"`
|
||||
}
|
||||
|
||||
// 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,6 +52,13 @@ 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="`
|
||||
|
|
@ -65,6 +72,7 @@ type ProcessConfig struct {
|
|||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue