From 447300101db021c5ef2e67549ed5879fc7a6b9bc Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Sun, 7 Jul 2019 12:45:41 +0900 Subject: [PATCH] Small tweak for ALSA underruns The hardcoded errno was replaced by a constant, and `snd_pcm_prepare` was replaced by `snd_pcm_recover` per best practice (the underlying implementation seems same for now, though). --- src/host/alsa/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/host/alsa/mod.rs b/src/host/alsa/mod.rs index 8ab4c81..ac68914 100644 --- a/src/host/alsa/mod.rs +++ b/src/host/alsa/mod.rs @@ -712,10 +712,10 @@ impl EventLoop { available_frames as alsa::snd_pcm_uframes_t, ); - if result == -32 { + if result as i32 == -libc::EPIPE { // buffer underrun // TODO: Notify the user of this. - alsa::snd_pcm_prepare(stream.channel); + alsa::snd_pcm_recover(stream.channel, result as i32, 0); } else if let Err(err) = check_errors(result as _) { let description = format!("`snd_pcm_writei` failed: {}", err); let err = BackendSpecificError { description };