From 21d67947dd6b9f49607c980812cab4f83e97d6a9 Mon Sep 17 00:00:00 2001 From: DH Date: Fri, 4 Oct 2024 16:53:55 +0300 Subject: [PATCH] rpcsx-os: alsa: avoid recursion --- rpcsx-os/audio/AlsaDevice.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/rpcsx-os/audio/AlsaDevice.cpp b/rpcsx-os/audio/AlsaDevice.cpp index 49ab4027c..dabdd526e 100644 --- a/rpcsx-os/audio/AlsaDevice.cpp +++ b/rpcsx-os/audio/AlsaDevice.cpp @@ -248,20 +248,21 @@ long AlsaDevice::write(void *buf, long len) { while (true) { snd_pcm_sframes_t r = snd_pcm_writei(mPCMHandle, buf, frames); - if (r == -EPIPE) { - if (fixXRun() == 0) { - return write(buf, len); - } - continue; + if (r == -EPIPE) { + r = fixXRun(); + + if (r == 0) { + continue; + } } if (r == -ESTRPIPE) { - if (resume() == 0) { - return write(buf, len); - } + r = resume(); - continue; + if (r == 0) { + continue; + } } if (r < 0) {