From 34b6160805c4995a8edf5f9b3328f5e492ae4c44 Mon Sep 17 00:00:00 2001 From: BearOso Date: Mon, 20 Dec 2021 12:15:27 -0600 Subject: [PATCH] pulseaudio: Fix potential stall with Pipewire Pipewire allows very small buffer sizes. It's possible that Snes9x will accumulate enough samples in fast-forward to exceed this. Instead of waiting forever for the buffer capacity to free up, just write the number of samples for the free space after one small wait. --- gtk/src/gtk_sound_driver_pulse.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/src/gtk_sound_driver_pulse.cpp b/gtk/src/gtk_sound_driver_pulse.cpp index e73b56ef..11c5599c 100644 --- a/gtk/src/gtk_sound_driver_pulse.cpp +++ b/gtk/src/gtk_sound_driver_pulse.cpp @@ -239,7 +239,7 @@ void S9xPulseSoundDriver::samples_available() if (Settings.SoundSync && !Settings.TurboMode && !Settings.Mute) { - while ((int)bytes < samples * 2) + if ((int)bytes < samples * 2) { int usec_to_sleep = ((samples >> 1) - (bytes >> 2)) * 10000 / (Settings.SoundPlaybackRate / 100);