render: avoid hashing null node
This commit is contained in:
@@ -76,7 +76,8 @@ QVector<PreviewAutoCacher::HashData> PreviewAutoCacher::GenerateHashes(ViewerOut
|
||||
const rational &time = times.at(i);
|
||||
|
||||
// See if hash already exists in disk cache
|
||||
QByteArray hash = RenderManager::Hash(viewer,
|
||||
QByteArray hash = RenderManager::Hash(viewer->GetConnectedTextureOutput(),
|
||||
viewer->GetConnectedTextureValueHint(),
|
||||
viewer->GetVideoParams(),
|
||||
time);
|
||||
|
||||
@@ -84,6 +85,7 @@ QVector<PreviewAutoCacher::HashData> PreviewAutoCacher::GenerateHashes(ViewerOut
|
||||
bool hash_exists = existing_hashes.contains(hash);
|
||||
|
||||
if (!hash_exists) {
|
||||
// FIXME: Using CachePathName here is NOT thread safe and should be replaced
|
||||
hash_exists = QFileInfo::exists(cache->CachePathName(hash));
|
||||
|
||||
if (hash_exists) {
|
||||
@@ -545,7 +547,9 @@ void PreviewAutoCacher::TryRender()
|
||||
|
||||
// Check for newly invalidated video and hash it
|
||||
if (!invalidated_video_.isEmpty()) {
|
||||
if (hash_iterator_.HasNext()) {
|
||||
if (!copied_viewer_node_->GetConnectedTextureOutput()) {
|
||||
hash_iterator_.reset();
|
||||
} else if (hash_iterator_.HasNext()) {
|
||||
hash_iterator_.insert(invalidated_video_);
|
||||
} else {
|
||||
hash_iterator_ = TimeRangeListFrameIterator(invalidated_video_, viewer_node_->GetVideoParams().frame_rate_as_time_base());
|
||||
|
||||
@@ -102,13 +102,15 @@ void RenderManager::ClearOldDecoders()
|
||||
|
||||
QByteArray RenderManager::Hash(const Node *n, const Node::ValueHint &output, const VideoParams ¶ms, const rational &time)
|
||||
{
|
||||
HashTraverser hasher;
|
||||
return hasher.GetHash(n, output, params, TimeRange(time, time + params.frame_rate_as_time_base()));
|
||||
}
|
||||
Q_ASSERT(n);
|
||||
|
||||
QByteArray RenderManager::Hash(ViewerOutput *viewer, const VideoParams ¶ms, const rational &time)
|
||||
{
|
||||
return Hash(viewer->GetConnectedTextureOutput(), viewer->GetValueHintForInput(ViewerOutput::kTextureInput), params, time);
|
||||
if (n) {
|
||||
HashTraverser hasher;
|
||||
return hasher.GetHash(n, output, params, TimeRange(time, time + params.frame_rate_as_time_base()));
|
||||
} else {
|
||||
qCritical() << "Hash called with null node";
|
||||
return QByteArray();
|
||||
}
|
||||
}
|
||||
|
||||
RenderTicketPtr RenderManager::RenderFrame(ViewerOutput *viewer, ColorManager* color_manager,
|
||||
|
||||
@@ -67,7 +67,6 @@ public:
|
||||
* @brief Generate a unique identifier for a certain node at a cconst Node *n, const Node::ValueHint &outputertain time
|
||||
*/
|
||||
static QByteArray Hash(const Node *n, const Node::ValueHint &output, const VideoParams ¶ms, const rational &time);
|
||||
static QByteArray Hash(ViewerOutput *viewer, const VideoParams ¶ms, const rational &time);
|
||||
|
||||
/**
|
||||
* @brief Asynchronously generate a frame at a given time
|
||||
|
||||
Reference in New Issue
Block a user