fix(mic): harden capture session shutdown

- Prevent deadlock when stopping capture
- Make file recorder writes thread-safe
- Add idempotent close for recorder
- Cap waveIn devices and recover panics
- Validate mic device range in HTTP API
This commit is contained in:
2026-09-02 01:09:45 +03:00
parent eaa46e7494
commit 45f345123d
4 changed files with 200 additions and 104 deletions
+2 -2
View File
@@ -417,8 +417,8 @@ func parseMicDevice(r *http.Request) (int, error) {
if raw := r.URL.Query().Get("device"); raw != "" {
var err error
device, err = strconv.Atoi(raw)
if err != nil || device < 0 {
return 0, errors.New("device must be 0 or greater")
if err != nil || device < 0 || device > 64 {
return 0, errors.New("device must be 0 through 64")
}
}
return device, nil