set params on workers when a backend's params change
Previous iteration had params attached to the backend and the params couldn't change without being destroyed and re-instantiated. This is not necessary in this iteration so doing so only wastes resources.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <QDir>
|
||||
#include <QtMath>
|
||||
|
||||
#include "audiorenderworker.h"
|
||||
#include "common/filefunctions.h"
|
||||
|
||||
AudioRenderBackend::AudioRenderBackend(QObject *parent) :
|
||||
@@ -12,13 +13,16 @@ AudioRenderBackend::AudioRenderBackend(QObject *parent) :
|
||||
|
||||
void AudioRenderBackend::SetParameters(const AudioRenderingParams ¶ms)
|
||||
{
|
||||
// Since we're changing parameters, all the existing threads are invalid and must be removed. They will start again
|
||||
// next time this Node has to process anything.
|
||||
Close();
|
||||
|
||||
// Set new parameters
|
||||
params_ = params;
|
||||
|
||||
// Set params on all processors
|
||||
// FIXME: Undefined behavior if the processors are currently working, this may need to be delayed like the
|
||||
// recompile signal
|
||||
foreach (RenderWorker* worker, processors_) {
|
||||
static_cast<AudioRenderWorker*>(worker)->SetParameters(params_);
|
||||
}
|
||||
|
||||
// Regenerate the cache ID
|
||||
RegenerateCacheID();
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <QtMath>
|
||||
|
||||
#include "render/pixelservice.h"
|
||||
#include "videorenderworker.h"
|
||||
|
||||
VideoRenderBackend::VideoRenderBackend(QObject *parent) :
|
||||
RenderBackend(parent)
|
||||
@@ -137,13 +138,16 @@ const VideoRenderingParams &VideoRenderBackend::params() const
|
||||
|
||||
void VideoRenderBackend::SetParameters(const VideoRenderingParams& params)
|
||||
{
|
||||
// Since we're changing parameters, all the existing threads are invalid and must be removed. They will start again
|
||||
// next time this Node has to process anything.
|
||||
Close();
|
||||
|
||||
// Set new parameters
|
||||
params_ = params;
|
||||
|
||||
// Set params on all processors
|
||||
// FIXME: Undefined behavior if the processors are currently working, this may need to be delayed like the
|
||||
// recompile signal
|
||||
foreach (RenderWorker* worker, processors_) {
|
||||
static_cast<VideoRenderWorker*>(worker)->SetParameters(params_);
|
||||
}
|
||||
|
||||
// Regenerate the cache ID
|
||||
RegenerateCacheID();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user