Capture latency needs to be updated before playback latency,
various internal parts depend on this order (which is also
the default for libjack itself).
Retain min/max when copying inherited latency from
connected ports.
When there is a direct connection port A out -> port B in,
min/max latency range should be retained in direction
of signal flow.
Ardour can only adjust latency in reverse direction of signal flow
to match min = max with an internal delay-line. ie set playback
latency of an input port, or capture latency of an output port.
This allows to get public latency ranges for any port
including Ardour's latency-compensation as well as including
any latency induced by external JACK applications.
It is mainly useful to detect ambiguous latency and to
forward public port latency of connected ports.
When switching backends, the effective sample-rate is zero.
This only affects the butler thread (the only active thread when
stopped). The actual issue here is the butler calling
"non-realtime-stop" without a backend. However fixing 0/0
generally seems appropriate.
```
#0 in int_div_round<long>(long, long) (x=0, y=0) at ../libs/pbd/pbd/integer_division.h:36
#1 in Temporal::samples_to_superclock(int64_t, int) (samples=0, sr=0) at ../libs/temporal/temporal/superclock.h:39
#2 in Temporal::timepos_t::timepos_t(long) (this=0x7f94bc0a5890, s=0) at ../libs/temporal/temporal/timeline.h:55
#3 in ARDOUR::Automatable::non_realtime_locate(long) (this=0x55a12a980cc8, now=0) at ../libs/ardour/automatable.cc:421
#4 in ARDOUR::Route::non_realtime_locate(long) (this=0x55a12a980ae0, pos=0) at ../libs/ardour/route.cc:5462
#5 in ARDOUR::Session::non_realtime_stop(bool, int, bool&) (this=0x55a12e0cd000, abort=false, on_entry=1, finished=@0x7f94bc0a5e0f: true) at ../libs/ardour/session_transport.cc:1487
#6 in ARDOUR::Session::butler_transport_work(bool) (this=0x55a12e0cd000, have_process_lock=false) at ../libs/ardour/session_transport.cc:1153
#7 in ARDOUR::Butler::thread_work() (this=0x55a12f3b7000) at ../libs/ardour/butler.cc:222
#8 in ARDOUR::Butler::_thread_work(void*) (arg=0x55a12f3b7000) at ../libs/ardour/butler.cc:16
```
There are cases where gtk modules log critical messages,
notably gtk-2.0/modules/libgail.so can trigger
`g_log: g_object_unref: assertion 'G_IS_OBJECT (object)' failed`,
which should not cause Ardour to terminate.
Somewhat unbelievably, macOS defines size_t as unsigned long, which the compiler there
believes is distinct from unsigned long long even then they have the same bitwidth
and signedness. We don't have any string converters for unsigned long, only uint64_t
(unsigned long long), so various things break.
Firstly, ::compute_bounding_box() cannot allocate space, so do not try to do that here.
Secondly, if there is no allocation yet, use the CairoWidget's own size_request()
Simply comparing connected latency min/max is insufficient
and allows for false positives.
get_connected_latency_range() reports private, uncompensated
latency for internal ports. In this case an additional test
is required to match it against the reported latency of
connected ports.
Since 13b8a9727bb05 remote connected ports now correctly
report latency for both internal as well as external ports.
Previously Ardour only announced processor latency.
Routes that had additional latency to compensate for those
have not published this delay.
This is of no concern with internal backends, however with JACK,
Ardour reported incorrect *individual* port-latencies of
routes that perform PDC.
Since public port latency now includes delay-compensation,
some extra work is required to unset it before recalculating
latency of paths that include external ports.