refactor: cap waveform decode length + guard frombuffer + tighten test

This commit is contained in:
Ethanfel committed 2026-07-02 15:00:34 +02:00
1 parent 12eaa944a7
commit 7501c4729b
3 files changed
+11 -2

No files matched your search

+3 -1
View File
@@ -32,4 +32,6 @@ def load_region_samples(path: str, start: float, duration: float,
return np.zeros(0, dtype="float32")
if proc.returncode != 0 or not proc.stdout:
return np.zeros(0, dtype="float32")
return np.frombuffer(proc.stdout, dtype="float32")
buf = proc.stdout
buf = buf[: len(buf) - (len(buf) % 4)]
return np.frombuffer(buf, dtype="float32")