feat: harden engine config, discovery and backpressure stats
- config: validate port/quality/fps/source/stream-index ranges on load and before engine start (flinger.Config.Validate) - discovery: add Announce option to disable multicast (GUI checkbox, CLI --no-announce); absent JSON key keeps the default true - backpressure: count dropped frames in the TCP sender, expose via engine Status and a live counter in the GUI status label - docs: record M3/M4 decisions and X11 coverage via the portal backend
This commit is contained in:
@@ -23,11 +23,15 @@ type Config struct {
|
||||
Source string `json:"source"`
|
||||
Audio bool `json:"audio"`
|
||||
StreamIndex int `json:"stream_index"`
|
||||
// Announce is a *bool so an absent JSON key (older config files) keeps
|
||||
// the default instead of silently disabling announcements.
|
||||
Announce *bool `json:"announce"`
|
||||
}
|
||||
|
||||
// Default returns the default configuration.
|
||||
func Default() Config {
|
||||
c := flinger.DefaultConfig()
|
||||
announce := c.Announce
|
||||
return Config{
|
||||
Name: c.Name,
|
||||
Port: c.Port,
|
||||
@@ -36,11 +40,16 @@ func Default() Config {
|
||||
Source: c.Source,
|
||||
Audio: c.Audio,
|
||||
StreamIndex: c.StreamIndex,
|
||||
Announce: &announce,
|
||||
}
|
||||
}
|
||||
|
||||
// ToFlinger converts a persisted config to the engine config.
|
||||
func (c Config) ToFlinger() flinger.Config {
|
||||
announce := true
|
||||
if c.Announce != nil {
|
||||
announce = *c.Announce
|
||||
}
|
||||
return flinger.Config{
|
||||
Name: c.Name,
|
||||
Port: c.Port,
|
||||
@@ -49,6 +58,7 @@ func (c Config) ToFlinger() flinger.Config {
|
||||
Source: c.Source,
|
||||
Audio: c.Audio,
|
||||
StreamIndex: c.StreamIndex,
|
||||
Announce: announce,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,6 +106,10 @@ func Load() (Config, error) {
|
||||
if c.Source == "" {
|
||||
c.Source = d.Source
|
||||
}
|
||||
if c.Announce == nil {
|
||||
announce := true
|
||||
c.Announce = &announce
|
||||
}
|
||||
return c, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user