Fix use of final flag more than once at end of processing (causing a test failure with libsamplerate)
This commit is contained in:
@@ -695,7 +695,7 @@ D_SRC::resampleInterleaved(float *const BQ_R__ out,
|
|||||||
// expected output, and (b) when the ratio has just changed, we
|
// expected output, and (b) when the ratio has just changed, we
|
||||||
// should aim to supply a shortish block next
|
// should aim to supply a shortish block next
|
||||||
|
|
||||||
if (outcount > int(ceil(incount * ratio) + 5)) {
|
if (!final && (outcount > int(ceil(incount * ratio) + 5))) {
|
||||||
outcount = int(ceil(incount * ratio) + 5);
|
outcount = int(ceil(incount * ratio) + 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -754,6 +754,10 @@ D_SRC::resampleInterleaved(float *const BQ_R__ out,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cerr << "Resampler::process: final = " << final << ", incount = "
|
||||||
|
// << incount << ", outcount = " << outcount << ", ratio = "
|
||||||
|
// << ratio << ", gen = " << data.output_frames_gen << endl;
|
||||||
|
|
||||||
return (int)data.output_frames_gen;
|
return (int)data.output_frames_gen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -771,7 +771,7 @@ R3Stretcher::process(const float *const *input, size_t samples, bool final)
|
|||||||
if (resampleInput == 0) resampleInput = 1;
|
if (resampleInput == 0) resampleInput = 1;
|
||||||
|
|
||||||
prepareInput(input, inputIx, resampleInput);
|
prepareInput(input, inputIx, resampleInput);
|
||||||
|
|
||||||
int resampleOutput = m_resampler->resample
|
int resampleOutput = m_resampler->resample
|
||||||
(m_channelAssembly.resampled.data(),
|
(m_channelAssembly.resampled.data(),
|
||||||
maxResampleOutput,
|
maxResampleOutput,
|
||||||
@@ -1008,13 +1008,18 @@ R3Stretcher::consume()
|
|||||||
m_channelAssembly.mixdown[c] = cd->mixdown.data();
|
m_channelAssembly.mixdown[c] = cd->mixdown.data();
|
||||||
m_channelAssembly.resampled[c] = cd->resampled.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
|
resampledCount = m_resampler->resample
|
||||||
(m_channelAssembly.resampled.data(),
|
(m_channelAssembly.resampled.data(),
|
||||||
m_channelData[0]->resampled.size(),
|
m_channelData[0]->resampled.size(),
|
||||||
m_channelAssembly.mixdown.data(),
|
m_channelAssembly.mixdown.data(),
|
||||||
outhop,
|
outhop,
|
||||||
1.0 / m_pitchScale,
|
1.0 / m_pitchScale,
|
||||||
m_mode == ProcessMode::Finished && readSpace < inhop);
|
final);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit
|
// Emit
|
||||||
|
|||||||
Reference in New Issue
Block a user