cache: include single frame tasks as video tasks

This commit is contained in:
itsmattkc
2021-03-26 10:28:58 +11:00
parent 3c2da0a966
commit ce80fccd80
+12 -12
View File
@@ -282,7 +282,8 @@ bool PreviewAutoCacher::HasActiveJobs() const
{
return !hash_tasks_.isEmpty()
|| !audio_tasks_.isEmpty()
|| !video_tasks_.isEmpty();
|| !video_tasks_.isEmpty()
|| !single_frame_tasks_.isEmpty();
}
void PreviewAutoCacher::AddNode(Node *node)
@@ -377,16 +378,22 @@ void PreviewAutoCacher::ClearHashQueue(bool wait)
void PreviewAutoCacher::ClearVideoQueue(bool wait)
{
// Copy because tasks that cancel immediately will be automatically removed from the list
auto copy = video_tasks_;
auto vt_copy = video_tasks_;
auto sft_copy = single_frame_tasks_;
for (auto it=copy.cbegin(); it!=copy.cend(); it++) {
for (auto it=vt_copy.cbegin(); it!=vt_copy.cend(); it++) {
it.key()->Cancel();
}
foreach (RenderTicketWatcher* watcher, sft_copy) {
watcher->Cancel();
}
if (wait) {
copy = video_tasks_;
for (auto it=copy.cbegin(); it!=copy.cend(); it++) {
for (auto it=vt_copy.cbegin(); it!=vt_copy.cend(); it++) {
it.key()->WaitForFinished();
}
foreach (RenderTicketWatcher* watcher, sft_copy) {
watcher->WaitForFinished();
}
}
has_changed_ = true;
@@ -606,13 +613,6 @@ void PreviewAutoCacher::SetViewerNode(Sequence *viewer_node)
// be in the cache for later use.
ClearVideoDownloadQueue(true);
// Wait for any single frame renders to finish
foreach (RenderTicketWatcher* watcher, single_frame_tasks_) {
watcher->Cancel();
watcher->WaitForFinished();
}
single_frame_tasks_.clear();
// Clear any single frame render that might be queued
single_frame_render_ = nullptr;