In this emergency, increase the buffer size by a factor rather than only by a constant amount - because if this arises because of an overlong increment being broken down into littler bits, we would end up doing it again and again, which is much more expensive. This makes a huge performance difference in cases where a time map ends up mapping very little input into a great expanse of output

This commit is contained in:
Chris Cannam
2020-09-22 10:35:50 +01:00
parent f42a369b8e
commit 8df9558868

View File

@@ -521,7 +521,14 @@ RubberBandStretcher::Impl::processChunkForChannel(size_t c,
// This is an unhappy situation.
RingBuffer<float> *oldbuf = cd.outbuf;
cd.outbuf = oldbuf->resized(oldbuf->getSize() + (required - ws));
cd.outbuf = oldbuf->resized(oldbuf->getSize() * 2);
if (m_debugLevel > 1) {
cerr << "(Write space was " << ws << ", needed " << required
<< ": resized output buffer from " << oldbuf->getSize()
<< " to " << cd.outbuf->getSize() << ")" << endl;
}
m_emergencyScavenger.claim(oldbuf);
}