B Watson | 20 Aug 02:10 2011
Picon

realtime capabilities for jack and its apps

Proposal: the doinst.sh for any audio synthesis or production package that
uses jack-audio-connection-kit should contain code in the doinst.sh like so:

setcap cap_ipc_lock,cap_sys_nice=ep usr/bin/whatever

This gives the binary the ability to run with POSIX realtime scheduling
priority (SCHED_FIFO) and to lock its pages so they won't be swapped
(via mlockall()).

The jack-audio-connection-kit README mentions this, and claims that
POSIX capabilities aren't supported on reiserfs, but this is outdated
(reiserfs in 13.37 does support them).

These capabilities make a noticeable difference in audio quality even
when using a stock Slack kernel without the realtime patch. Without
cap_sys_nice, it's possible for e.g. the cached samples in fluidsynth to
be swapped to disk, causing huge gaps in playback. Without cap_ipc_lock,
you get smaller gaps, but lots of them (known as x-runs, in jack
terminology). In fact, it's safe to say that these audio applications
are completely useless without the capabilities (meaning that every user
who installs any of them, has to manually run the above setcap command,
assuming they're aware they need to).

The caps have to be set in the doinst.sh because tar doesn't preserve
POSIX filesystem capability bits.

Comments, objections, discussion...?
Felix Pfeifer | 20 Aug 10:54 2011

Re: realtime capabilities for jack and its apps

> Proposal: the doinst.sh for any audio synthesis or production package that
> uses jack-audio-connection-kit should contain code in the doinst.sh like so:
>
> setcap cap_ipc_lock,cap_sys_nice=ep usr/bin/whatever

I think it's a good idea. I am maintaining a few audio Slackbuildscripts
and thought about doing so, but i was afraid it would be removed.
Would it? Maybe for security or whatever reasons we add an option
to all these scripts that is mentioned in the README like this:
"to disable setcaps pass the option --disable-caps to the script"
$ whatever.Slackbuild --disable-caps

The default behavior then would be to include setcaps in the doinst.sh.

Felix

Gmane