drain audio (#838)

This commit is contained in:
CJ Pais 2026-02-19 10:32:30 +08:00 committed by GitHub
parent cbc80802cb
commit 3c0fb95185
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -319,8 +319,14 @@ fn run_consumer(
Cmd::Stop(reply_tx) => {
recording = false;
// Drain any audio chunks that were captured but not yet consumed
while let Ok(remaining) = sample_rx.try_recv() {
frame_resampler.push(&remaining, &mut |frame: &[f32]| {
handle_frame(frame, true, &vad, &mut processed_samples)
});
}
frame_resampler.finish(&mut |frame: &[f32]| {
// we still want to process the last few frames
handle_frame(frame, true, &vad, &mut processed_samples)
});