[LAD] xrun callback

Raphaël BOLLEN raphael.bollen at gmail.com
Thu Sep 4 15:42:01 UTC 2014

> On 09/03/2014 04:04 PM, Raphaël  BOLLEN wrote:
>> Hello,
>> I'm trying to use jack_set_xrun_callback to be notified in my
>> application of eventual xrun.
>> in the documentation of the function I see a note: that 'this function
>> cannot be called while the client is activated'.
>> Does it mean that my client must call jack_set_xrun_callback before
>> being activated
> Yes. First set the callback, and only later call jack_activate().
> Two tiny jack clients which may come in handy:
>  * jackxrun: report x-runs on the command line
>  * busyjack: create artificial load
> http://gareus.org/gitweb/?p=jackfreqd.git;a=tree;f=tools;
> gcc -o jackxrun jackxrun.c -ljack
> gcc -o busyjack busyjack.c -ljack
> ./jackxrun # reports xruns in the terminal
> ./busyjack 90 # will ramp things up to 90% DSP load (default is 50)
> It can be used to create x-runs, yet it's not the same as a x-run from hw.
> [..]
>> It says return 0 on success. Does it mean the callback must succeed.
> Your callback function must return 0.
> Cheers!
> robin

Thanks Robin for your explanations and tools.

I think the x-runs (one every few hours) I get are due to hardware because jack_cpu_load is < 5% and 
system load average < 0.2 all periods. The problem is that those xruns make the process thread jump 
to 100% cpu and the process disappears from QJackctl, although jack and other clients still run 
normally. The code also runs fine on another computer.

I'm currently testing with jack priority raised from 40 to 70 to be above irq threads. I did not yet 
have an xrun in this config but It's a bit early to conclude.

I will also try busyjack.

Best regards


More information about the Linux-audio-dev mailing list