properly calculate requrired thread buffers

This commit is contained in:
Robin Gareus 2016-04-14 14:13:26 +02:00
parent 5af4ce47eb
commit 7962176219
4 changed files with 16 additions and 6 deletions

View File

@ -134,6 +134,8 @@ class LIBARDOUR_API PluginInsert : public Processor
}
}
ChanCount required_buffers () const { return _required_buffers; }
// allow to override output_streams(), implies "Custom Mode"
// only the owning route may call these (with process lock held)
@ -305,6 +307,7 @@ class LIBARDOUR_API PluginInsert : public Processor
ChanCount _configured_out;
ChanCount _custom_out;
ChanCount _cached_sidechain_pins;
ChanCount _required_buffers;
bool _configured;
bool _no_inplace;

View File

@ -1455,6 +1455,12 @@ PluginInsert::configure_io (ChanCount in, ChanCount out)
_no_inplace = check_inplace ();
_mapping_changed = false;
/* only the "noinplace_buffers" thread buffers need to be this large,
* this can be optimized. other buffers are fine with
* ChanCount::max (natural_input_streams (), natural_output_streams())
*/
_required_buffers = natural_input_streams () + natural_output_streams() * get_count();
if (old_in != in || old_out != out || old_internal != _configured_internal
|| (old_match.method != _match.method && (old_match.method == Split || _match.method == Split))
) {

View File

@ -2199,17 +2199,18 @@ Route::configure_processors_unlocked (ProcessorStreams* err)
processor_max_streams = ChanCount::max(processor_max_streams, c->first);
processor_max_streams = ChanCount::max(processor_max_streams, c->second);
boost::shared_ptr<IOProcessor> iop;
boost::shared_ptr<PluginInsert> pi;
if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*p)) != 0) {
/* plugins connected via Split or Hide Match may have more channels.
* route/scratch buffers are needed for all of them
* The configuration may only be a subset (both input and output)
*/
processor_max_streams = ChanCount::max(processor_max_streams, pi->input_streams());
processor_max_streams = ChanCount::max(processor_max_streams, pi->internal_streams());
processor_max_streams = ChanCount::max(processor_max_streams, pi->output_streams());
processor_max_streams = ChanCount::max(processor_max_streams, pi->natural_input_streams() * pi->get_count());
processor_max_streams = ChanCount::max(processor_max_streams, pi->natural_output_streams() * pi->get_count());
processor_max_streams = ChanCount::max(processor_max_streams, pi->required_buffers());
}
else if ((iop = boost::dynamic_pointer_cast<IOProcessor>(*p)) != 0) {
processor_max_streams = ChanCount::max(processor_max_streams, iop->natural_input_streams());
processor_max_streams = ChanCount::max(processor_max_streams, iop->natural_output_streams());
}
out = c->second;

View File

@ -72,7 +72,7 @@ ThreadBuffers::ensure_buffers (ChanCount howmany, size_t custom)
}
scratch_buffers->ensure_buffers (*t, count, size);
noinplace_buffers->ensure_buffers (*t, count + count, size); // in + out
noinplace_buffers->ensure_buffers (*t, count, size);
mix_buffers->ensure_buffers (*t, count, size);
silent_buffers->ensure_buffers (*t, count, size);
route_buffers->ensure_buffers (*t, count, size);