fixed various caching issues when rapidly changing values

This commit is contained in:
itsmattkc
2019-09-09 04:07:51 +10:00
parent 6fcfd01c8f
commit ba7a10177f
37 changed files with 495 additions and 217 deletions
+20 -6
View File
@@ -89,6 +89,16 @@ public:
*/
bool HasHash(const QByteArray& hash);
/**
* @brief Return whether a frame is currently being cached
*/
bool IsCaching(const QByteArray& hash);
/**
* @brief Check if a frame is currently being cached, and if not reserve it
*/
bool TryCache(const QByteArray& hash);
/**
* @brief Return current instance of a RenderThread (or nullptr if there is none)
*
@@ -131,6 +141,8 @@ private:
*/
void CacheNext();
bool ShouldPushTexture(const rational &time);
/**
* @brief Return the path of the cached image at this time
*/
@@ -174,8 +186,6 @@ private:
QString cache_id_;
bool caching_;
RendererProcessThread* master_thread_;
rational cache_frame_;
QVector<uchar*> cache_frame_load_buffer_;
QVector<RendererDownloadThreadPtr> download_threads_;
@@ -185,15 +195,19 @@ private:
QMap<rational, QByteArray> time_hash_map_;
QMutex download_list_mutex_;
QVector<QByteArray> download_list_;
QMutex cache_hash_list_mutex_;
QVector<QByteArray> cache_hash_list_;
private slots:
void ThreadCallback();
void ThreadCallback(RenderTexturePtr texture, const rational& time, const QByteArray& hash);
void ThreadRequestSibling(NodeDependency dep);
void DownloadThreadFinished(const rational &time, const QByteArray &hash);
void ThreadFrameAlreadyExists(const rational &time, const QByteArray &hash);
void MapHashToTimecode(const rational &time, const QByteArray &hash);
void ThreadIgnoredFrame();
};