Fix ESP32 audio dropouts and improve streaming reliability
FLAC encoder now tracks frame numbers and reuses per-channel sample buffers to reduce allocations. Client dialer always frees the active slot on release so mDNS re-emissions can reconnect cleanly. Server send buffer uses drop-oldest instead of hard failure, with lateness tracking. Added engine stats logging (chunks/sec, kbps) and writer diagnostics. UI simplified to a single play/pause toggle that auto-starts playback on preset selection. Added --preset CLI flag for headless startup. Removed stale systemd service files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -60,6 +60,7 @@ func main() {
|
||||
mqttDiscovery string
|
||||
rate int
|
||||
channels int
|
||||
preset string
|
||||
)
|
||||
|
||||
addInt(&port, 8927, "port", "p", "Sendspin WebSocket port")
|
||||
@@ -74,6 +75,7 @@ func main() {
|
||||
addStr(&mqttDiscovery, "homeassistant", "mqtt-discovery", "", "Home Assistant discovery prefix")
|
||||
addInt(&rate, 48000, "rate", "r", "capture sample rate")
|
||||
addInt(&channels, 2, "channels", "", "capture channels")
|
||||
addStr(&preset, "", "preset", "", "activate this preset id at startup (begins playback immediately)")
|
||||
|
||||
flag.Usage = usage
|
||||
flag.Parse()
|
||||
@@ -147,6 +149,13 @@ func main() {
|
||||
go func() { serverDone <- server.Start() }()
|
||||
log.Printf("Sendspin server %q on :%d", name, port)
|
||||
|
||||
if preset != "" {
|
||||
if err := mgr.SetActivePreset(preset); err != nil {
|
||||
log.Fatalf("activate preset %q: %v", preset, err)
|
||||
}
|
||||
log.Printf("preset %q activated at startup", preset)
|
||||
}
|
||||
|
||||
sig := make(chan os.Signal, 1)
|
||||
signal.Notify(sig, os.Interrupt, syscall.SIGTERM)
|
||||
select {
|
||||
|
||||
Reference in New Issue
Block a user