From f7ad7772d1258f00d2d9e8169dbcaa1ae66a3e7b Mon Sep 17 00:00:00 2001 From: David Reid Date: Sun, 7 Apr 2024 14:38:09 +1000 Subject: [PATCH] ALSA: Try making the handling of poll() a bit more robust. Public issue https://github.com/mackron/miniaudio/issues/836. --- miniaudio.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/miniaudio.h b/miniaudio.h index 208df04a..6fa49727 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -28214,8 +28214,15 @@ static ma_result ma_device_wait__alsa(ma_device* pDevice, ma_snd_pcm_t* pPCM, st int resultALSA; int resultPoll = poll(pPollDescriptors, pollDescriptorCount, -1); if (resultPoll < 0) { - ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[ALSA] poll() failed.\n"); - return ma_result_from_errno(errno); + ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_WARNING, "[ALSA] poll() failed.\n"); + + /* + There have been reports that poll() is returning an error randomly and that instead of + returning an error, simply trying again will work. I'm experimenting with adopting this + advice. + */ + continue; + /*return ma_result_from_errno(errno);*/ } /*