MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / CleanUp

Method CleanUp

src/CacheMemory.cpp:250–267  ·  view source on GitHub ↗

Clean up cached frames that exceed the number in our max_bytes variable

Source from the content-addressed store, hash-verified

248
249// Clean up cached frames that exceed the number in our max_bytes variable
250void CacheMemory::CleanUp()
251{
252 // Do we auto clean up?
253 if (max_bytes > 0)
254 {
255 // Create a scoped lock, to protect the cache from multiple threads
256 const std::lock_guard<std::recursive_mutex> lock(*cacheMutex);
257
258 while (GetBytes() > max_bytes && frame_numbers.size() > 20)
259 {
260 // Get the oldest frame number.
261 int64_t frame_to_remove = frame_numbers.back();
262
263 // Remove frame_number and frame
264 Remove(frame_to_remove);
265 }
266 }
267}
268
269
270// Generate JSON string of this object

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected