hold worker busy state in renderbackend rather than in renderworker

Workers run in different threads and the backends can poll whether the worker
is currently busy or not. However the previous iteration has the worker (and an
atomic int) provide the busy state which could easily desync with the main
thread (since all workers run in different threads). By holding the busy states
in the main thread, the main thread will always be able to poll the busy state
accurately.
This commit is contained in:
itsmattkc
2019-12-06 19:38:57 +11:00
parent 5227e10f39
commit f6064b40df
9 changed files with 41 additions and 58 deletions
-6
View File
@@ -18,8 +18,6 @@ const VideoRenderingParams &VideoRenderWorker::video_params()
NodeValueTable VideoRenderWorker::RenderInternal(const NodeDependency& path)
{
qDebug() << "Rendering" << path.in().toDouble() << "on" << this;
// Get hash of node graph
// We use SHA-1 for speed (benchmarks show it's the fastest hash available to us)
QCryptographicHash hasher(QCryptographicHash::Sha1);
@@ -141,8 +139,6 @@ void VideoRenderWorker::CloseInternal()
void VideoRenderWorker::Download(NodeDependency dep, QByteArray hash, QVariant texture, QString filename)
{
working_++;
PixelFormatInfo format_info = PixelService::GetPixelFormatInfo(video_params().format());
// Set up OIIO::ImageSpec for compressing cached images on disk
@@ -164,8 +160,6 @@ void VideoRenderWorker::Download(NodeDependency dep, QByteArray hash, QVariant t
} else {
qWarning() << "Failed to open output file:" << filename;
}
working_--;
}
NodeValueTable VideoRenderWorker::RenderBlock(TrackOutput *track, const TimeRange &range)