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.
This commit is contained in:
BearOso 2021-12-20 12:15:27 -06:00
parent a283596722
commit 34b6160805
1 changed files with 1 additions and 1 deletions

View File

@ -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);