autocache: added brief delay between changes and recache
This commit is contained in:
@@ -91,7 +91,7 @@ void Config::SetDefaults()
|
||||
SetEntryInternal(QStringLiteral("Loop"), NodeParam::kBoolean, false);
|
||||
SetEntryInternal(QStringLiteral("SplitClipsCopyNodes"), NodeParam::kBoolean, true);
|
||||
|
||||
SetEntryInternal(QStringLiteral("AutoCacheInterval"), NodeParam::kInt, 250);
|
||||
SetEntryInternal(QStringLiteral("AutoCacheDelay"), NodeParam::kInt, 1000);
|
||||
|
||||
SetEntryInternal(QStringLiteral("NodeCatColor0"), NodeParam::kColor, QVariant::fromValue(Color(0.75f, 0.75f, 0.75f)));
|
||||
SetEntryInternal(QStringLiteral("NodeCatColor1"), NodeParam::kColor, QVariant::fromValue(Color(0.25f, 0.25f, 0.25f)));
|
||||
|
||||
@@ -24,6 +24,10 @@ PreviewAutoCacher::PreviewAutoCacher() :
|
||||
{
|
||||
// Set default autocache range
|
||||
SetPlayhead(rational());
|
||||
|
||||
delayed_requeue_timer_.setInterval(Config::Current()[QStringLiteral("AutoCacheDelay")].toInt());
|
||||
delayed_requeue_timer_.setSingleShot(true);
|
||||
connect(&delayed_requeue_timer_, &QTimer::timeout, this, &PreviewAutoCacher::RequeueFrames);
|
||||
}
|
||||
|
||||
RenderTicketPtr PreviewAutoCacher::GetSingleFrame(const rational &t)
|
||||
@@ -169,7 +173,9 @@ void PreviewAutoCacher::HashesProcessed()
|
||||
if (hash_tasks_.contains(watcher)) {
|
||||
hash_tasks_.removeOne(watcher);
|
||||
|
||||
RequeueFrames();
|
||||
// Restart delayed requeue timer
|
||||
delayed_requeue_timer_.stop();
|
||||
delayed_requeue_timer_.start();
|
||||
}
|
||||
|
||||
// The cacher might be waiting for this job to finish
|
||||
@@ -595,6 +601,8 @@ void PreviewAutoCacher::TryRender()
|
||||
|
||||
void PreviewAutoCacher::RequeueFrames()
|
||||
{
|
||||
delayed_requeue_timer_.stop();
|
||||
|
||||
if (viewer_node_
|
||||
&& viewer_node_->video_frame_cache()->HasInvalidatedRanges()
|
||||
&& hash_tasks_.isEmpty()
|
||||
|
||||
@@ -104,11 +104,6 @@ private:
|
||||
|
||||
void TryRender();
|
||||
|
||||
/**
|
||||
* @brief Generic function called whenever the frames to render need to be (re)queued
|
||||
*/
|
||||
void RequeueFrames();
|
||||
|
||||
/**
|
||||
* @brief Process all changes to internal NodeGraph copy
|
||||
*
|
||||
@@ -156,6 +151,8 @@ private:
|
||||
|
||||
ColorManager* color_manager_;
|
||||
|
||||
QTimer delayed_requeue_timer_;
|
||||
|
||||
private slots:
|
||||
/**
|
||||
* @brief Handler for when the NodeGraph reports a video change over a certain time range
|
||||
@@ -202,6 +199,11 @@ private slots:
|
||||
|
||||
void SingleFrameFinished();
|
||||
|
||||
/**
|
||||
* @brief Generic function called whenever the frames to render need to be (re)queued
|
||||
*/
|
||||
void RequeueFrames();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user