From 226dadbd19201f5889da676677e27861a65b0708 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 6 May 2022 01:25:05 +0200 Subject: [PATCH] Further reduce DSP load of debug builds In all years of using these assert()s never triggered. Besides there are valid_port() tests in other strategic locations that are not periodically hit in realtime context. --- libs/ardour/port.cc | 2 +- libs/ardour/port_engine_shared.cc | 4 ++-- libs/backends/alsa/alsa_audiobackend.cc | 1 - libs/backends/coreaudio/coreaudio_backend.cc | 1 - libs/backends/portaudio/portaudio_backend.cc | 1 - libs/backends/pulseaudio/pulseaudio_backend.cc | 1 - 6 files changed, 3 insertions(+), 7 deletions(-) diff --git a/libs/ardour/port.cc b/libs/ardour/port.cc index 76552ea592..4f2020e392 100644 --- a/libs/ardour/port.cc +++ b/libs/ardour/port.cc @@ -219,7 +219,7 @@ Port::connected_to (std::string const & o) const return false; } - return port_engine.connected_to (_port_handle, AudioEngine::instance()->make_port_name_non_relative (o)); + return port_engine.connected_to (_port_handle, AudioEngine::instance()->make_port_name_non_relative (o), true); } int diff --git a/libs/ardour/port_engine_shared.cc b/libs/ardour/port_engine_shared.cc index c4966240e7..6a5cbff369 100644 --- a/libs/ardour/port_engine_shared.cc +++ b/libs/ardour/port_engine_shared.cc @@ -748,12 +748,12 @@ PortEngineSharedImpl::connected (PortEngine::PortHandle port_handle, bool /* pro } bool -PortEngineSharedImpl::connected_to (PortEngine::PortHandle src, const std::string& dst, bool /*process_callback_safe*/) +PortEngineSharedImpl::connected_to (PortEngine::PortHandle src, const std::string& dst, bool process_callback_safe) { BackendPortPtr src_port = boost::dynamic_pointer_cast (src); BackendPortPtr dst_port = find_port (dst); #ifndef NDEBUG - if (!valid_port (src_port) || !dst_port) { + if (!process_callback_safe && (!valid_port (src_port) || !dst_port)) { PBD::error << string_compose (_("%1::connected_to: Invalid Port"), _instance_name) << endmsg; return false; } diff --git a/libs/backends/alsa/alsa_audiobackend.cc b/libs/backends/alsa/alsa_audiobackend.cc index 3c8fb1bc60..f979a1ecf3 100644 --- a/libs/backends/alsa/alsa_audiobackend.cc +++ b/libs/backends/alsa/alsa_audiobackend.cc @@ -1790,7 +1790,6 @@ AlsaAudioBackend::get_buffer (PortEngine::PortHandle port_handle, pframes_t nfra { BackendPortPtr port = boost::dynamic_pointer_cast (port_handle); assert (port); - assert (valid_port (port)); return port->get_buffer (nframes); } diff --git a/libs/backends/coreaudio/coreaudio_backend.cc b/libs/backends/coreaudio/coreaudio_backend.cc index 9e9a119cdd..3afeb12a30 100644 --- a/libs/backends/coreaudio/coreaudio_backend.cc +++ b/libs/backends/coreaudio/coreaudio_backend.cc @@ -1218,7 +1218,6 @@ CoreAudioBackend::get_buffer (PortEngine::PortHandle port_handle, pframes_t nfra { boost::shared_ptr port = boost::dynamic_pointer_cast (port_handle); assert (port); - assert (valid_port (port)); if (!port || !valid_port (port)) return NULL; // XXX remove me return port->get_buffer (nframes); } diff --git a/libs/backends/portaudio/portaudio_backend.cc b/libs/backends/portaudio/portaudio_backend.cc index 8298af53ff..5b3fc46bf4 100644 --- a/libs/backends/portaudio/portaudio_backend.cc +++ b/libs/backends/portaudio/portaudio_backend.cc @@ -1446,7 +1446,6 @@ PortAudioBackend::get_buffer (PortEngine::PortHandle port_handle, pframes_t nfra { boost::shared_ptr port = boost::dynamic_pointer_cast(port_handle); assert (port); - assert (valid_port (port)); if (!port || !valid_port (port)) return NULL; // XXX remove me return port->get_buffer (nframes); } diff --git a/libs/backends/pulseaudio/pulseaudio_backend.cc b/libs/backends/pulseaudio/pulseaudio_backend.cc index 47fd73d939..8c4f08d224 100644 --- a/libs/backends/pulseaudio/pulseaudio_backend.cc +++ b/libs/backends/pulseaudio/pulseaudio_backend.cc @@ -981,7 +981,6 @@ PulseAudioBackend::get_buffer (PortEngine::PortHandle port_handle, pframes_t nfr BackendPortPtr port = boost::dynamic_pointer_cast (port_handle); assert (port); - assert (valid_port (port)); return port->get_buffer (nframes); }