From 189cce0e23dddaaaf4ab6e1cac387c9c954f22fa Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 24 Dec 2015 17:50:38 +0100 Subject: Add experimental 'silencing' of all active events on frame size change. --- src/cachemanager.cc | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) 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; } } -- cgit v1.2.3