videorenderer: if an InvalidateVisible() signal comes through, cancel the queue

Optimization that frees up the GPU as quickly as possible when the user starts
making changes that may require quick feedback.
This commit is contained in:
itsmattkc
2020-05-07 00:56:16 +10:00
parent 2eb753e99d
commit c61adbf2a2
7 changed files with 59 additions and 27 deletions
+20 -4
View File
@@ -152,7 +152,7 @@ void VideoRenderBackend::ConnectWorkerToThis(RenderWorker *processor)
connect(video_processor, &VideoRenderWorker::GeneratedFrame, this, &VideoRenderBackend::ThreadGeneratedFrame, Qt::QueuedConnection);
}
void VideoRenderBackend::InvalidateCacheInternal(const rational &start_range, const rational &end_range)
void VideoRenderBackend::InvalidateCacheInternal(const rational &start_range, const rational &end_range, bool only_visible)
{
TimeRange invalidated(start_range, end_range);
@@ -160,7 +160,21 @@ void VideoRenderBackend::InvalidateCacheInternal(const rational &start_range, co
emit RangeInvalidated(invalidated);
Requeue();
if (only_visible) {
// We're only caching this frame, and for maximum responsiveness, should cancel the rest of the
// queue
cache_queue_.clear();
cache_queue_.InsertTimeRange(TimeRange(start_range, end_range));
CacheNext();
} else {
// Rework the queue
Requeue();
}
}
VideoRenderFrameCache *VideoRenderBackend::frame_cache()
@@ -201,9 +215,11 @@ QString VideoRenderBackend::GetCachedFrame(const rational &time)
void VideoRenderBackend::UpdateLastRequestedTime(const rational &time)
{
last_time_requested_ = time;
if (last_time_requested_ != time) {
last_time_requested_ = time;
Requeue();
Requeue();
}
}
NodeInput *VideoRenderBackend::GetDependentInput()