renderer: copy cache path before render to avoid race conditions
This commit is contained in:
@@ -430,7 +430,7 @@ void RenderBackend::RunNextJob()
|
||||
worker->SetRenderMode(render_mode_);
|
||||
worker->SetPreviewGenerationEnabled(generate_audio_previews_);
|
||||
worker->SetCopyMap(©_map_);
|
||||
worker->SetViewerNode(viewer_node_);
|
||||
worker->SetCachePath(viewer_node_->video_frame_cache()->GetCacheDirectory());
|
||||
|
||||
// Move ticket from queue to running list
|
||||
RenderTicketPtr ticket = render_queue_.front();
|
||||
|
||||
@@ -318,10 +318,11 @@ QVariant RenderWorker::ProcessFrameGeneration(const Node* node, const GenerateJo
|
||||
QVariant RenderWorker::GetCachedFrame(const Node* node, const rational& time)
|
||||
{
|
||||
if (render_mode_ == RenderMode::kOffline
|
||||
&& !cache_path_.isEmpty()
|
||||
&& node->id() == QStringLiteral("org.olivevideoeditor.Olive.videoinput")) {
|
||||
QByteArray hash = HashNode(node, video_params(), time);
|
||||
|
||||
FramePtr f = viewer_->video_frame_cache()->LoadCacheFrame(hash);
|
||||
FramePtr f = FrameHashCache::LoadCacheFrame(cache_path_, hash);
|
||||
|
||||
if (f) {
|
||||
// The cached frame won't load with the correct divider by default, so we enforce it here
|
||||
|
||||
@@ -50,11 +50,6 @@ public:
|
||||
available_ = a;
|
||||
}
|
||||
|
||||
void SetViewerNode(ViewerOutput* viewer)
|
||||
{
|
||||
viewer_ = viewer;
|
||||
}
|
||||
|
||||
void SetVideoParams(const VideoParams& params)
|
||||
{
|
||||
video_params_ = params;
|
||||
@@ -90,6 +85,11 @@ public:
|
||||
generate_audio_previews_ = e;
|
||||
}
|
||||
|
||||
void SetCachePath(const QString& s)
|
||||
{
|
||||
cache_path_ = s;
|
||||
}
|
||||
|
||||
void Hash(RenderTicketPtr ticket, ViewerOutput* viewer, const QVector<rational>& times);
|
||||
|
||||
/**
|
||||
@@ -186,14 +186,14 @@ private:
|
||||
|
||||
bool generate_audio_previews_;
|
||||
|
||||
ViewerOutput* viewer_;
|
||||
|
||||
QHash<Node*, Node*>* copy_map_;
|
||||
|
||||
RenderMode::Mode render_mode_;
|
||||
|
||||
QTimer* cleanup_timer_;
|
||||
|
||||
QString cache_path_;
|
||||
|
||||
static const int kMaxDecoderLife;
|
||||
|
||||
private slots:
|
||||
|
||||
Reference in New Issue
Block a user