diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-12-24 17:50:38 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-01-20 13:32:03 +0100 |
commit | 189cce0e23dddaaaf4ab6e1cac387c9c954f22fa (patch) | |
tree | aa8bfca29d27e3a77807fe56213bb8f133f51994 /src | |
parent | 84e2cacec69c73712100de31585da3fe96c94704 (diff) |
Add experimental 'silencing' of all active events on frame size change.
Diffstat (limited to 'src')
-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; } } |