diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d8ec9027..6ced6bb64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Unreleased +- ALSA(process_output): pass `silent=true` to `PCM.try_recover`, so it doesn't write to stderr - All error enums are now `Clone`. # Version 0.15.3 (2024-03-04) diff --git a/src/host/alsa/mod.rs b/src/host/alsa/mod.rs index 515d5abea..669b7aaea 100644 --- a/src/host/alsa/mod.rs +++ b/src/host/alsa/mod.rs @@ -835,9 +835,15 @@ fn process_output( loop { match stream.channel.io_bytes().writei(buffer) { Err(err) if err.errno() == libc::EPIPE => { - // buffer underrun - // TODO: Notify the user of this. - let _ = stream.channel.try_recover(err, false); + // ALSA underrun or overrun. + // See https://github.com/alsa-project/alsa-lib/blob/b154d9145f0e17b9650e4584ddfdf14580b4e0d7/src/pcm/pcm.c#L8767-L8770 + // Even if these recover successfully, they still may cause audible glitches. + + // TODO: + // Should we notify the user about successfully recovered errors? + // Should we notify the user about failures in try_recover, rather than ignoring them? + // (Both potentially not real-time-safe) + _ = stream.channel.try_recover(err, true); } Err(err) => { error_callback(err.into());