stream : stop on ^C when no audio is received (#2822)

Add check for ctrl-c in potentially endless loop while calling audio.get()
to receive sound.

Co-authored-by: Petter Reinholdtsen <pere@debian.org>
This commit is contained in:
petterreinholdtsen 2025-02-27 07:59:51 +01:00 committed by GitHub
parent 17addf7104
commit b5d21359c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -244,6 +244,11 @@ int main(int argc, char ** argv) {
if (!use_vad) { if (!use_vad) {
while (true) { while (true) {
// handle Ctrl + C
is_running = sdl_poll_events();
if (!is_running) {
break;
}
audio.get(params.step_ms, pcmf32_new); audio.get(params.step_ms, pcmf32_new);
if ((int) pcmf32_new.size() > 2*n_samples_step) { if ((int) pcmf32_new.size() > 2*n_samples_step) {