From b017f2014147222edb82b59a5a094189c8aafab9 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 16 Oct 2019 08:12:04 -0600 Subject: [PATCH] correct size computation for RTMidiBuffer, and reduce expansion amount --- libs/ardour/rt_midibuffer.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libs/ardour/rt_midibuffer.cc b/libs/ardour/rt_midibuffer.cc index bd4a7e3d42..2e1a1bade6 100644 --- a/libs/ardour/rt_midibuffer.cc +++ b/libs/ardour/rt_midibuffer.cc @@ -120,10 +120,8 @@ RTMidiBuffer::write (TimeType time, Evoral::EventType /*type*/, uint32_t size, c { /* This buffer stores only MIDI, we don't care about the value of "type" */ - const size_t bytes_to_merge = sizeof (time) + sizeof (uint32_t); - - if (_size + bytes_to_merge > _capacity) { - resize (_capacity + 8192); // XXX 8192 is completely arbitrary + if (_size == _capacity) { + resize (_capacity + 1024); // XXX 1024 is completely arbitrary } _data[_size].timestamp = time;