mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 00:34:59 +01:00
move latency-recompute into dedicated thread.
this fixes an issue with jack1 and jack_latency_recompute() since must not send a server request from inside the server callback.
This commit is contained in:
parent
b64a6b658e
commit
0d050de94e
4 changed files with 20 additions and 3 deletions
|
|
@ -360,6 +360,7 @@ public:
|
||||||
/** the processors have changed; the parameter indicates what changed */
|
/** the processors have changed; the parameter indicates what changed */
|
||||||
PBD::Signal1<void,RouteProcessorChange> processors_changed;
|
PBD::Signal1<void,RouteProcessorChange> processors_changed;
|
||||||
PBD::Signal1<void,void*> record_enable_changed;
|
PBD::Signal1<void,void*> record_enable_changed;
|
||||||
|
PBD::Signal0<void> processor_latency_changed;
|
||||||
/** the metering point has changed */
|
/** the metering point has changed */
|
||||||
PBD::Signal0<void> meter_change;
|
PBD::Signal0<void> meter_change;
|
||||||
PBD::Signal0<void> signal_latency_changed;
|
PBD::Signal0<void> signal_latency_changed;
|
||||||
|
|
|
||||||
|
|
@ -1509,8 +1509,10 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
|
||||||
typedef std::queue<AutoConnectRequest> AutoConnectQueue;
|
typedef std::queue<AutoConnectRequest> AutoConnectQueue;
|
||||||
Glib::Threads::Mutex _auto_connect_queue_lock;
|
Glib::Threads::Mutex _auto_connect_queue_lock;
|
||||||
AutoConnectQueue _auto_connect_queue;
|
AutoConnectQueue _auto_connect_queue;
|
||||||
|
guint _latency_recompute_pending;
|
||||||
|
|
||||||
void auto_connect (const AutoConnectRequest&);
|
void auto_connect (const AutoConnectRequest&);
|
||||||
|
void queue_latency_recompute ();
|
||||||
|
|
||||||
/* SessionEventManager interface */
|
/* SessionEventManager interface */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2959,10 +2959,8 @@ PluginInsert::latency_changed ()
|
||||||
{
|
{
|
||||||
// this is called in RT context, LatencyChanged is emitted after run()
|
// this is called in RT context, LatencyChanged is emitted after run()
|
||||||
_latency_changed = true;
|
_latency_changed = true;
|
||||||
#if 1 // TODO check possible deadlock in RT-context (esp. with jack) latency-callback.
|
|
||||||
// XXX This also needs a proper API not an owner() hack.
|
// XXX This also needs a proper API not an owner() hack.
|
||||||
static_cast<Route*>(owner ())->processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
|
static_cast<Route*>(owner ())->processor_latency_changed (); /* EMIT SIGNAL */
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -279,6 +279,7 @@ Session::Session (AudioEngine &eng,
|
||||||
, _reconnecting_routes_in_progress (false)
|
, _reconnecting_routes_in_progress (false)
|
||||||
, _route_deletion_in_progress (false)
|
, _route_deletion_in_progress (false)
|
||||||
, destructive_index (0)
|
, destructive_index (0)
|
||||||
|
, _latency_recompute_pending (0)
|
||||||
, _track_number_decimals(1)
|
, _track_number_decimals(1)
|
||||||
, default_fade_steepness (0)
|
, default_fade_steepness (0)
|
||||||
, default_fade_msecs (0)
|
, default_fade_msecs (0)
|
||||||
|
|
@ -3418,6 +3419,7 @@ Session::add_routes_inner (RouteList& new_routes, bool input_auto_connect, bool
|
||||||
|
|
||||||
r->output()->changed.connect_same_thread (*this, boost::bind (&Session::set_worst_io_latencies_x, this, _1, _2));
|
r->output()->changed.connect_same_thread (*this, boost::bind (&Session::set_worst_io_latencies_x, this, _1, _2));
|
||||||
r->processors_changed.connect_same_thread (*this, boost::bind (&Session::route_processors_changed, this, _1));
|
r->processors_changed.connect_same_thread (*this, boost::bind (&Session::route_processors_changed, this, _1));
|
||||||
|
r->processor_latency_changed.connect_same_thread (*this, boost::bind (&Session::queue_latency_recompute, this));
|
||||||
|
|
||||||
if (r->is_master()) {
|
if (r->is_master()) {
|
||||||
_master_out = r;
|
_master_out = r;
|
||||||
|
|
@ -6838,6 +6840,16 @@ Session::auto_connect_route (boost::shared_ptr<Route> route, bool connect_inputs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Session::queue_latency_recompute ()
|
||||||
|
{
|
||||||
|
g_atomic_int_inc (&_latency_recompute_pending);
|
||||||
|
if (pthread_mutex_trylock (&_auto_connect_mutex) == 0) {
|
||||||
|
pthread_cond_signal (&_auto_connect_cond);
|
||||||
|
pthread_mutex_unlock (&_auto_connect_mutex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Session::auto_connect (const AutoConnectRequest& ar)
|
Session::auto_connect (const AutoConnectRequest& ar)
|
||||||
{
|
{
|
||||||
|
|
@ -7003,6 +7015,10 @@ Session::auto_connect_thread_run ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (g_atomic_int_and (&_latency_recompute_pending, 0)) {
|
||||||
|
update_latency_compensation ();
|
||||||
|
}
|
||||||
|
|
||||||
pthread_cond_wait (&_auto_connect_cond, &_auto_connect_mutex);
|
pthread_cond_wait (&_auto_connect_cond, &_auto_connect_mutex);
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock (&_auto_connect_mutex);
|
pthread_mutex_unlock (&_auto_connect_mutex);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue