diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-12-24 17:50:38 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-12-24 17:50:38 +0100 |
commit | 2a9dda465230b3b129dc942095a7c8a99ef5fa50 (patch) | |
tree | 360b2f88655dcb41498b476942947514cefca15c /src/cachemanager.cc | |
parent | 1070276519f7a60547da3f567a8f4d9caaa0b0c3 (diff) |
Add experimental 'silencing' of all active events on frame size change.
Diffstat (limited to 'src/cachemanager.cc')
-rw-r--r-- | src/cachemanager.cc | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/cachemanager.cc b/src/cachemanager.cc index b2e10ac..d394d8c 100644 --- a/src/cachemanager.cc +++ b/src/cachemanager.cc @@ -249,6 +249,9 @@ void CacheManager::close(cacheid_t id) void CacheManager::setFrameSize(size_t framesize) { + MutexAutolock le(m_events); + MutexAutolock li(m_ids); + if(framesize > this->framesize) { delete[] nodata; @@ -256,7 +259,31 @@ void CacheManager::setFrameSize(size_t framesize) for(size_t i = 0; i < framesize; ++i) { - nodata[i] = 0; + nodata[i] = 0.0f; + } + } + + // Run through all active cache_ts and disable them. + for(auto it = id2cache.begin(); it != id2cache.end(); ++it) + { + cacheid_t cacheid = it - id2cache.begin(); + + // Look up id in available ids: + bool found = false; + for(auto i = availableids.begin(); i != availableids.end(); ++i) + { + if(cacheid == *i) + { + found = true; + break; + } + } + + if(!found) + { + // Force use of nodata in all of the rest of the next() calls. + it->localpos = CHUNKSIZE(framesize); + it->ready = false; } } |