From 921bd1fe360f90d76db053265ff483ba84070699 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 27 Sep 2011 18:09:30 +0000 Subject: safety fix for the connection-based latency in the event that there are no connections git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@10146 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/route.cc | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 72b5c33057..cd4c637040 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -2478,24 +2478,32 @@ Route::update_port_latencies (vector& from, vector& to, bool playb jack_latency_range_t all_connections; - all_connections.min = ~((jack_nframes_t) 0); - all_connections.max = 0; - - /* iterate over all "from" ports and determine the latency range for all of their - connections to the "outside" (outside of this Route). - */ - - for (vector::const_iterator p = from.begin(); p != from.end(); ++p) { - - jack_latency_range_t range; - - (*p)->get_connected_latency_range (range, playback); - - // cerr << "***** for " << (*p)->name() << " CLR = " << range.min << " - " << range.max << endl; - - all_connections.min = min (all_connections.min, range.min); - all_connections.max = max (all_connections.max, range.max); - } + if (from.empty()) { + + all_connections.min = 0; + all_connections.max = 0; + + } else { + + all_connections.min = ~((jack_nframes_t) 0); + all_connections.max = 0; + + /* iterate over all "from" ports and determine the latency range for all of their + connections to the "outside" (outside of this Route). + */ + + for (vector::const_iterator p = from.begin(); p != from.end(); ++p) { + + jack_latency_range_t range; + + (*p)->get_connected_latency_range (range, playback); + + // cerr << "***** for " << (*p)->name() << " CLR = " << range.min << " - " << range.max << endl; + + all_connections.min = min (all_connections.min, range.min); + all_connections.max = max (all_connections.max, range.max); + } + } /* set the "from" port latencies to the max/min range of all their connections */ -- cgit v1.2.3