drain audio (#838)
This commit is contained in:
parent
cbc80802cb
commit
3c0fb95185
1 changed files with 7 additions and 1 deletions
|
|
@ -319,8 +319,14 @@ fn run_consumer(
|
||||||
Cmd::Stop(reply_tx) => {
|
Cmd::Stop(reply_tx) => {
|
||||||
recording = false;
|
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]| {
|
frame_resampler.finish(&mut |frame: &[f32]| {
|
||||||
// we still want to process the last few frames
|
|
||||||
handle_frame(frame, true, &vad, &mut processed_samples)
|
handle_frame(frame, true, &vad, &mut processed_samples)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue