cpal icon indicating copy to clipboard operation
cpal copied to clipboard

[PIPEWIRE+JACK] Frequent Xruns with specific block size settings (beep example)

Open the-drunk-coder opened this issue 3 years ago • 0 comments

Hi,

I've run into a lot of Xruns recently when using a specific blocksize/samplerate setting ... it was driving me crazy until I found that the "beep" example provided in the cpal repo has the same problem.

To reproduce, start the beep example with

PIPEWIRE_LATENCY="128/44100" cargo run --features jack --example beep -- --jack

At least on my machine, with the internal sound card, there's a very regular occurrence of Xruns, about one per second.

What I don't understand so far is, in a different project of mine I use cpal in more or less exactly the same manner on the same setup, and I can go down to blocksizes of 64 without problems, even though the audio callback is way heavier.

So I'm really confused why a simple example like the beep example create such a problem.

Some more symptoms/hints:

  • with a blocksize of 512 the problem doesn't occur
  • with another app (i.e. firefox) playing audio in the background, the problem disappears
  • sometimes the problem doesn't occur at all, but most of the time it does
  • with a USB soundcard the problem doesn't occur

About my setup:

  • Arch Linux with kernel: Linux ___ 5.19.13-arch1-1 #1 SMP PREEMPT_DYNAMIC Tue, 04 Oct 2022 14:36:58 +0000 x86_64 GNU/Linux
  • Pipewire with all the drop-in replacements for jack, pulseaudio, etc (that is, no actual JACK server is running)

Any hints on why this happens or how to fix it ?

the-drunk-coder avatar Oct 13 '22 17:10 the-drunk-coder