1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-16 16:20:50 +02:00

Bug2591 mitigation, maybe: coalesce touching dropout intervals...

... The post-processing of an excessive number of small, touching intervals
was one cause of apparent hangs when stopping recording to a slow external
device and using a high recording sample rate, in my own trials.
This commit is contained in:
Paul Licameli 2020-11-24 22:28:49 -05:00
parent 6a10177404
commit 262dbabbf5

View File

@ -4066,8 +4066,14 @@ void AudioIoCallback::FillInputBuffers(
auto start = mPlaybackSchedule.GetTrackTime() +
len / mRate + mRecordingSchedule.mLatencyCorrection;
auto duration = (framesPerBuffer - len) / mRate;
auto interval = std::make_pair( start, duration );
mLostCaptureIntervals.push_back( interval );
auto pLast = mLostCaptureIntervals.empty()
? nullptr : &mLostCaptureIntervals.back();
if (pLast &&
fabs(pLast->first + pLast->second - start) < 0.5/mRate)
// Make one bigger interval, not two butting intervals
pLast->second = start + duration - pLast->first;
else
mLostCaptureIntervals.emplace_back( start, duration );
}
if (len < framesPerBuffer)