Fix use of final flag more than once at end of processing (causing a test failure with libsamplerate)

This commit is contained in:
Chris Cannam
2023-04-05 11:14:04 +01:00
parent 376bf4dbd6
commit b9f2b58e1f
2 changed files with 12 additions and 3 deletions

View File

@@ -771,7 +771,7 @@ R3Stretcher::process(const float *const *input, size_t samples, bool final)
if (resampleInput == 0) resampleInput = 1;
prepareInput(input, inputIx, resampleInput);
int resampleOutput = m_resampler->resample
(m_channelAssembly.resampled.data(),
maxResampleOutput,
@@ -1008,13 +1008,18 @@ R3Stretcher::consume()
m_channelAssembly.mixdown[c] = cd->mixdown.data();
m_channelAssembly.resampled[c] = cd->resampled.data();
}
bool final = (m_mode == ProcessMode::Finished &&
readSpace < inhop &&
cd0->scales.at(longest)->accumulatorFill <= outhop);
resampledCount = m_resampler->resample
(m_channelAssembly.resampled.data(),
m_channelData[0]->resampled.size(),
m_channelAssembly.mixdown.data(),
outhop,
1.0 / m_pitchScale,
m_mode == ProcessMode::Finished && readSpace < inhop);
final);
}
// Emit