renderer: use shared backend when caching

I think there was an earlier commit with a similar name but turns out
I'd only done foundational work in that commit and never actually
properly set it up. Of course once I did, there were several issues that
needed fixing to make it work correctly, but now it works as expected.

Heavily optimizes larger projects by allowing cache jobs to only copy
what has changed.
This commit is contained in:
itsmattkc
2020-07-10 18:39:47 +10:00
parent 36dd06d2dc
commit efd90d5c8f
10 changed files with 104 additions and 55 deletions
+5 -7
View File
@@ -214,7 +214,7 @@ void ViewerWidget::ConnectNodeInternal(ViewerOutput *n)
void ViewerWidget::DisconnectNodeInternal(ViewerOutput *n)
{
Pause();
PauseInternal();
if (cache_background_task_ == our_cache_background_task_) {
StopAllBackgroundCacheTasks(true);
@@ -646,7 +646,8 @@ RenderTicketPtr ViewerWidget::GetFrame(const rational &t, bool clear_render_queu
// Frame has been cached, grab the frame
QString cache_fn = GetConnectedNode()->video_frame_cache()->CachePathName(cached_hash);
RenderTicketPtr ticket = std::make_shared<RenderTicket>(RenderTicket::kTypeVideo, TimeRange(t, t));
RenderTicketPtr ticket = std::make_shared<RenderTicket>(RenderTicket::kTypeVideo,
QVariant::fromValue(t));
QtConcurrent::run(DecodeCachedImage, ticket, cache_fn, t);
return ticket;
@@ -875,10 +876,7 @@ void ViewerWidget::StartBackgroundCaching()
cache_wait_timer_.start();
} else {
cache_background_task_ = new CacheTask(GetConnectedNode(),
GetConnectedNode()->video_params(),
GetConnectedNode()->audio_params(),
false);
cache_background_task_ = new CacheTask(renderer_, false);
our_cache_background_task_ = cache_background_task_;
@@ -1223,7 +1221,7 @@ void ViewerWidget::ViewerInvalidatedRange()
StopAllBackgroundCacheTasks(false);
if (!(qApp->mouseButtons() & Qt::LeftButton)) {
StartBackgroundCaching();
cache_wait_timer_.start();
}
}