[pulseaudio-discuss] Patch: More buffering for the jack sink module

Tanu Kaskinen tanuk at iki.fi
Tue May 8 12:56:37 PDT 2007

Hi all!

I intended to get rid of the "jack_transport; play; exit" phase of
starting jackd and pulseaudio. But then I installed a realtime patched
kernel and started to run jackd with very low latency settings, and
found out that the jack sink module is unusable in such setup. So I had
more to fix - the processing callback had to be made realtime-safe. The
result is attached. This is the first patch I ever send anywhere, so it
may be in a wrong format or anything. It's the output of "svn diff".

What I did was adding internal buffering to the sink. That's implemented
with Jack's utility ringbuffer. Now the processing function just reads
from the buffer and tells the pulse core (correct terminology?) to
render some more audio, but the processing function doesn't wait for
that to happen. I guess that's about it.

A new module parameter is added too. buffersize takes an unsigned
integer as an argument, which is the amount of frames the user wishes to
be in the ringbuffer, defaulting to 4096. The actual buffersize is
rounded up to nearest power of two, and is always greater than the jack
blocksize (frames per processing call).

The blocksize change callback isn't tested, since it seems that my jack
doesn't support dynamic changing of the blocksize. I believe I enabled
it when configuring the jack build, but maybe it's just not yet
implemented. Or maybe I didn't enable it.

Tanu Kaskinen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: more_buffering.patch
Type: text/x-patch
Size: 14043 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20070508/0b89ad24/attachment.bin>

More information about the pulseaudio-discuss mailing list