renderer: share render backend for auto-cache tasks
Since auto-cache events start and stop fairly frequently (and are somewhat heavy to create/destroy), we can save a lot of cycles over time by sharing the same backend between them all.
This commit is contained in:
Vendored
+18
-6
@@ -27,16 +27,18 @@
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
CacheTask::CacheTask(RenderBackend *backend, bool in_out_only) :
|
||||
RenderTask(backend),
|
||||
in_out_only_(in_out_only)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
CacheTask::CacheTask(ViewerOutput* viewer, const VideoParams& vparams, const AudioParams &aparams, bool in_out_only) :
|
||||
RenderTask(viewer, vparams, aparams),
|
||||
in_out_only_(in_out_only)
|
||||
{
|
||||
SetTitle(tr("Caching \"%1\"").arg(viewer->media_name()));
|
||||
|
||||
backend()->EnablePreviewGeneration(job_time());
|
||||
|
||||
// Render fastest quality
|
||||
backend()->SetRenderMode(RenderMode::kOffline);
|
||||
Init();
|
||||
}
|
||||
|
||||
bool CacheTask::Run()
|
||||
@@ -83,4 +85,14 @@ void CacheTask::AudioDownloaded(const TimeRange &range, SampleBufferPtr samples)
|
||||
}
|
||||
}
|
||||
|
||||
void CacheTask::Init()
|
||||
{
|
||||
SetTitle(tr("Caching \"%1\"").arg(viewer()->media_name()));
|
||||
|
||||
backend()->EnablePreviewGeneration(job_time());
|
||||
|
||||
// Render fastest quality
|
||||
backend()->SetRenderMode(RenderMode::kOffline);
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
Reference in New Issue
Block a user