revised video renderer's invalidate cache to use ranges rather than discrete
frames Previously, when the video renderer received a dirty cache signal, it would proceed to extract all frames from the range and queue them. However, this could be extremely slow for long ranges since it had to iterate through the entire range and calculate the individual frames it contained. Now, we use the same range combining system as audio and automatically calculate the next frame within the range only when necessary. Essentially the same work, but split up over time and done only when needed leading to no discernible UI pause when invalidating cache.
This commit is contained in:
@@ -27,27 +27,6 @@ void AudioRenderBackend::SetParameters(const AudioRenderingParams ¶ms)
|
||||
RegenerateCacheID();
|
||||
}
|
||||
|
||||
void AudioRenderBackend::InvalidateCache(const rational &start_range, const rational &end_range)
|
||||
{
|
||||
if (!params_.is_valid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
RenderBackend::InvalidateCache(start_range, end_range);
|
||||
|
||||
rational start_range_adj = qMax(rational(0), start_range);
|
||||
rational end_range_adj = qMin(GetSequenceLength(), end_range);
|
||||
|
||||
// Add the range to the list
|
||||
cache_queue_.InsertTimeRange(TimeRange(start_range_adj, end_range_adj));
|
||||
|
||||
// Queue value update
|
||||
QueueValueUpdate();
|
||||
|
||||
// Start caching cycle if it hasn't started already
|
||||
CacheNext();
|
||||
}
|
||||
|
||||
void AudioRenderBackend::ConnectViewer(ViewerOutput *node)
|
||||
{
|
||||
connect(node, SIGNAL(AudioChangedBetween(const rational&, const rational&)), this, SLOT(InvalidateCache(const rational&, const rational&)));
|
||||
|
||||
Reference in New Issue
Block a user