diff --git a/libs/ardour/port_manager.cc b/libs/ardour/port_manager.cc index 90934b085d..4ec50bee4e 100644 --- a/libs/ardour/port_manager.cc +++ b/libs/ardour/port_manager.cc @@ -1680,8 +1680,8 @@ PortManager::check_for_ambiguous_latency (bool log) const boost::shared_ptr plist = _ports.reader(); for (Ports::iterator pi = plist->begin(); pi != plist->end(); ++pi) { boost::shared_ptr const& p (pi->second); - /* check one to many connections on the receiving side */ - if (p->sends_output () || (p->flags () & IsTerminal)) { + /* check one to many connections */ + if (!p->sends_output () || (p->flags () & IsTerminal) || !p->connected ()) { continue; } if (boost::dynamic_pointer_cast(p)) { @@ -1689,51 +1689,13 @@ PortManager::check_for_ambiguous_latency (bool log) const } assert (port_is_mine (p->name ())); - LatencyRange rangeA; - p->get_connected_latency_range (rangeA, true); - - if (rangeA.min == rangeA.max) { - continue; - } - - /* check if latency-range of connected ports matches our own */ - - vector connections; - p->get_connections (connections); - - assert (!connections.empty()); - - for (vector::const_iterator c = connections.begin(); c != connections.end(); ++c) { - LatencyRange rangeB; - - if (!AudioEngine::instance()->port_is_mine (*c)) { - PortEngine::PortHandle ph = _backend->get_port_by_name (*c); - if (!ph) { - continue; - } - rangeB = _backend->get_latency_range (ph, true); - } else { - Ports::iterator x = plist->find (make_port_name_relative (*c)); - if (x == plist->end()) { - continue; - } - boost::shared_ptr const& pb (x->second); - if (pb->flags () & (IsTerminal | Hidden | TransportSyncPort)) { - continue; - } - pb->get_connected_latency_range (rangeB, true); - } - - if (rangeA == rangeB) { - continue; - } + LatencyRange range; + range.min = ~((pframes_t) 0); + range.max = 0; + p->collect_latency_from_backend (range, true); + if (range.min != range.max) { if (log) { - warning << string_compose( - _("Ambiguous latency for input '%1' (%2, %3)," - "receiving from port '%4' (%5, %6)"), - p->name(), rangeA.min, rangeA.max, - *c, rangeB.min, rangeB.max) - << endmsg; + warning << string_compose(_("Ambiguous latency for port '%1' (%2, %3)"), p->name(), range.min, range.max) << endmsg; rv = true; } else { return true;