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:
@@ -29,6 +29,7 @@ func TestSaveLoadRoundTrip(t *testing.T) {
|
||||
pathVar = filepath.Join(t.TempDir(), "config.json")
|
||||
defer func() { pathVar = old }()
|
||||
|
||||
announce := false
|
||||
want := Config{
|
||||
Name: "Studio",
|
||||
Port: 9898,
|
||||
@@ -37,6 +38,7 @@ func TestSaveLoadRoundTrip(t *testing.T) {
|
||||
Source: "pattern",
|
||||
Audio: false,
|
||||
StreamIndex: 1,
|
||||
Announce: &announce,
|
||||
}
|
||||
if err := Save(want); err != nil {
|
||||
t.Fatalf("Save: %v", err)
|
||||
@@ -46,7 +48,10 @@ func TestSaveLoadRoundTrip(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Load: %v", err)
|
||||
}
|
||||
if got != want {
|
||||
if got.Name != want.Name || got.Port != want.Port || got.Quality != want.Quality ||
|
||||
got.FPS != want.FPS || got.Source != want.Source || got.Audio != want.Audio ||
|
||||
got.StreamIndex != want.StreamIndex || got.Announce == nil || want.Announce == nil ||
|
||||
*got.Announce != *want.Announce {
|
||||
t.Errorf("round trip mismatch:\n got %+v\nwant %+v", got, want)
|
||||
}
|
||||
}
|
||||
@@ -74,4 +79,16 @@ func TestLoadFillsZeroValues(t *testing.T) {
|
||||
if c.Quality != 80 {
|
||||
t.Errorf("quality = %d, want filled default 80", c.Quality)
|
||||
}
|
||||
// Absent "announce" key must default to true (not false).
|
||||
if c.Announce == nil || !*c.Announce {
|
||||
t.Errorf("announce = %v, want default true", c.Announce)
|
||||
}
|
||||
}
|
||||
|
||||
// TestToFlingerAnnounceDefault checks the announce default survives conversion.
|
||||
func TestToFlingerAnnounceDefault(t *testing.T) {
|
||||
c := Config{}
|
||||
if !c.ToFlinger().Announce {
|
||||
t.Error("ToFlinger announce default should be true")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user