mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-02 17:09:26 +02:00
Bug2591, more mitigation: TransactionScopes mean fewer checkpoints...
... and probably less contention with the checkpoint thread during recording, and probably less total drop-out time when stress-testing recording with high sample rates or slow external devices or both. And another transaction scope for the post-processing of dropouts may reduce the total time spent there.
This commit is contained in:
parent
1efebb7cdc
commit
f5fd860430
@ -461,6 +461,8 @@ time warp info and AudioIOListener and whether the playback is looped.
|
|||||||
#include "prefs/GUISettings.h"
|
#include "prefs/GUISettings.h"
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
#include "Project.h"
|
#include "Project.h"
|
||||||
|
#include "DBConnection.h"
|
||||||
|
#include "ProjectFileIO.h"
|
||||||
#include "WaveTrack.h"
|
#include "WaveTrack.h"
|
||||||
|
|
||||||
#include "effects/RealtimeEffectManager.h"
|
#include "effects/RealtimeEffectManager.h"
|
||||||
@ -2373,14 +2375,27 @@ void AudioIO::StopStream()
|
|||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &interval : mLostCaptureIntervals) {
|
|
||||||
auto &start = interval.first;
|
if (!mLostCaptureIntervals.empty())
|
||||||
auto duration = interval.second;
|
{
|
||||||
for (auto &track : mCaptureTracks) {
|
// This scope may combine many splittings of wave tracks
|
||||||
GuardedCall([&] {
|
// into one transaction, lessening the number of checkpoints
|
||||||
track->SyncLockAdjust(start, start + duration);
|
Optional<TransactionScope> pScope;
|
||||||
});
|
if (mOwningProject) {
|
||||||
|
auto &pIO = ProjectFileIO::Get(*mOwningProject);
|
||||||
|
pScope.emplace(pIO.GetConnection(), "Dropouts");
|
||||||
}
|
}
|
||||||
|
for (auto &interval : mLostCaptureIntervals) {
|
||||||
|
auto &start = interval.first;
|
||||||
|
auto duration = interval.second;
|
||||||
|
for (auto &track : mCaptureTracks) {
|
||||||
|
GuardedCall([&] {
|
||||||
|
track->SyncLockAdjust(start, start + duration);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pScope)
|
||||||
|
pScope->Commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pListener)
|
if (pListener)
|
||||||
@ -2893,6 +2908,15 @@ void AudioIO::FillBuffers()
|
|||||||
if (mAudioThreadShouldCallFillBuffersOnce ||
|
if (mAudioThreadShouldCallFillBuffersOnce ||
|
||||||
deltat >= mMinCaptureSecsToCopy)
|
deltat >= mMinCaptureSecsToCopy)
|
||||||
{
|
{
|
||||||
|
// This scope may combine many appendings of wave tracks,
|
||||||
|
// and also an autosave, into one transaction,
|
||||||
|
// lessening the number of checkpoints
|
||||||
|
Optional<TransactionScope> pScope;
|
||||||
|
if (mOwningProject) {
|
||||||
|
auto &pIO = ProjectFileIO::Get(*mOwningProject);
|
||||||
|
pScope.emplace(pIO.GetConnection(), "Recording");
|
||||||
|
}
|
||||||
|
|
||||||
bool newBlocks = false;
|
bool newBlocks = false;
|
||||||
|
|
||||||
// Append captured samples to the end of the WaveTracks.
|
// Append captured samples to the end of the WaveTracks.
|
||||||
@ -3027,6 +3051,9 @@ void AudioIO::FillBuffers()
|
|||||||
auto pListener = GetListener();
|
auto pListener = GetListener();
|
||||||
if (pListener && newBlocks)
|
if (pListener && newBlocks)
|
||||||
pListener->OnAudioIONewBlocks(&mCaptureTracks);
|
pListener->OnAudioIONewBlocks(&mCaptureTracks);
|
||||||
|
|
||||||
|
if (pScope)
|
||||||
|
pScope->Commit();
|
||||||
}
|
}
|
||||||
// end of record buffering
|
// end of record buffering
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user