[Jack-Devel] jackd/engine.c XRun code

PrevNext  Index
DateSat, 26 May 2012 15:46:40 +0100
From John Rigg <[hidden] at jrigg dot co dot uk>
To[hidden] at lists dot jackaudio dot org
I've been looking at the XRun detection code in jackd/engine.c 
(jack 0.121.3) to see if I could find any clues to why JACK clients
like Ardour2 report xruns in some situations, when nothing is apparently
wrong with the audio and the alsa driver doesn't report any xruns.
I encounter this regularly when using ALSA pcm_multi to combine several
sound cards into one virtual device (as described here: 
http://www.jrigg.co.uk/linuxaudio/ice1712multi.html).

Here's what appears to be the relevant section in jackd/engine.c starting
at line 2071 (extra printfs added by me):


static void
jack_engine_delay (jack_engine_t *engine, float delayed_usecs)
{
	jack_event_t event;
	
	engine->control->frame_timer.reset_pending = 1;

/*****************************************************************************/
	printf("xrun_delayed_usecs %f\n", engine->control->xrun_delayed_usecs);
	printf("max_delayed_usecs %f\n", engine->control->max_delayed_usecs);
	printf("delayed_usecs %f\n", delayed_usecs);
/*****************************************************************************/

	engine->control->xrun_delayed_usecs = delayed_usecs;

	if (delayed_usecs > engine->control->max_delayed_usecs)
		engine->control->max_delayed_usecs = delayed_usecs;

	event.type = XRun;
	
	jack_deliver_event_to_all (engine, &event);
}


The above code doesn't run when I use a single sound card. Running a pair
of ice1712 based cards with pcm_multi produces a slew of printf messages
like these, scrolling rapidly off the screen:

xrun_delayed_usecs 0.000000
max_delayed_usecs 0.000000
delayed_usecs 0.000000

The values are always zero.

xrun_delayed_usecs gets initialised to 0 on line 1997.
max_delayed_usecs gets initialised to 0 on line 1998.

I couldn't find anywhere where these values get changed between
initialisation and being used in the above code. Can this be correct?

Disclaimer: I'm not an expert C programmer, so it's quite possible
I've missed something obvious. I also haven't yet found where the value
of delayed_usecs gets set, so any pointers would be appreciated.

John
PrevNext  Index

1338043202.18969_0.ltw:2, <20120526144640.GA2847 at localhost0 dot localdomain>