[LAD] JACK latency API clarifications

Robin Gareus robin at gareus.org
Thu Feb 20 22:47:08 UTC 2014

On 02/20/2014 11:32 PM, Stefano D'Angelo wrote:
Hi Stefano,

You got this right.

> Hi all,
> Let's say I have a client that introduces an amount of latency that's
> variable at runtime and potentially unbounded. From JACK's docs it
> seems that you need to recompute the min/max latencies in the latency
> callback that's called "by the server" whenever it feels like, but you
> can force that by calling jack_recompute_total_latencies (right?).


> The problem is, you are advised to call this last function only after
> calling jack_port_set_latency_range(), which you should only call in
> the latency callback, which may be called next month... am I dumb
> (probably) or is there a deadly loop?

It's called whenever the graph changes (e.g. port connections change) or
when some client invokes jack_recompute_total_latencies().

So whenever a setting in your app changes that affects the latency, call
jack_recompute_total_latencies(), which in turn will trigger the
callback set via jack_set_latency_callback(),  and there you set the
[new] port-latency(ies).


More information about the Linux-audio-dev mailing list