copy node graph before rendering

Previous iterations would use mutexes to prevent changing of the graph
mid-render, however several user actions would need to capture these mutexes
causing the main thread to hang until the current render job (frame/range of
samples) was complete. We now copy the nodes necessary as part of the "compile"
process so that the main thread shouldn't need nearly as much blocking while
caching occurs.
This commit is contained in:
itsmattkc
2019-11-23 08:53:52 +09:00
parent b233aa5319
commit 2cfccbfbef
7 changed files with 87 additions and 23 deletions
+3 -1
View File
@@ -26,7 +26,7 @@ void AudioRenderBackend::SetParameters(const AudioRenderingParams &params)
void AudioRenderBackend::InvalidateCache(const rational &start_range, const rational &end_range)
{
rational start_range_adj = qMax(rational(0), start_range);
rational end_range_adj = qMin(viewer_node()->Length(), end_range);
rational end_range_adj = qMin(SequenceLength(), end_range);
// Add the range to the list
cache_queue_.append(TimeRange(start_range_adj, end_range_adj));
@@ -41,6 +41,7 @@ void AudioRenderBackend::InvalidateCache(const rational &start_range, const rati
void AudioRenderBackend::ConnectViewer(ViewerOutput *node)
{
connect(node, SIGNAL(AudioChangedBetween(const rational&, const rational&)), this, SLOT(InvalidateCache(const rational&, const rational&)));
connect(node, SIGNAL(AudioGraphChanged()), this, SLOT(QueueRecompile()));
// FIXME: Hardcoded format
SetParameters(AudioRenderingParams(node->audio_params(), SAMPLE_FMT_FLT));
@@ -49,6 +50,7 @@ void AudioRenderBackend::ConnectViewer(ViewerOutput *node)
void AudioRenderBackend::DisconnectViewer(ViewerOutput *node)
{
disconnect(node, SIGNAL(AudioChangedBetween(const rational&, const rational&)), this, SLOT(InvalidateCache(const rational&, const rational&)));
disconnect(node, SIGNAL(AudioGraphChanged()), this, SLOT(QueueRecompile()));
}
bool AudioRenderBackend::GenerateCacheIDInternal(QCryptographicHash &hash)