From 77d12b490ed05e1257eb638ee47f55268b4dcfeb Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 6 Mar 2020 19:13:54 +0100 Subject: [PATCH] RT-safety use stack (not heap) for plugin pin mappings --- libs/ardour/ardour/chan_mapping.h | 7 ++++--- libs/ardour/ardour/plugin_insert.h | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libs/ardour/ardour/chan_mapping.h b/libs/ardour/ardour/chan_mapping.h index 07b623f8e1..cc42ed01bc 100644 --- a/libs/ardour/ardour/chan_mapping.h +++ b/libs/ardour/ardour/chan_mapping.h @@ -25,13 +25,14 @@ #include #include +#include "pbd/stack_allocator.h" #include "pbd/xml++.h" + #include "ardour/data_type.h" #include "ardour/chan_count.h" namespace ARDOUR { - /** A mapping from one set of channels to another. * The general form is 1 source (from), many sinks (to). * numeric IDs are used to identify sources and sinks. @@ -103,8 +104,8 @@ public: */ bool is_subset (const ChanMapping& superset) const; - typedef std::map TypeMapping; - typedef std::map Mappings; + typedef std::map, PBD::StackAllocator, 16> > TypeMapping; + typedef std::map, PBD::StackAllocator, 2> > Mappings; Mappings mappings() { return _mappings; } const Mappings& mappings() const { return _mappings; } diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index 68c1aaa604..003df28a38 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -29,6 +29,7 @@ #include +#include "pbd/stack_allocator.h" #include "pbd/timing.h" #include "ardour/ardour.h" @@ -370,7 +371,8 @@ private: /* ordered map [plugin instance ID] => ARDOUR::ChanMapping * TODO: consider replacing with boost::flat_map<> or std::vector<>. */ - class PinMappings : public std::map { + class PinMappings : public std::map , PBD::StackAllocator, 4> > + { public: /* this emulates C++11's std::map::at() * return mapping for given plugin instance */