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

Method GetSmallestFrame

src/CacheDisk.cpp:244–264  ·  view source on GitHub ↗

Get the smallest frame number (or NULL shared_ptr if no frame is found)

Source from the content-addressed store, hash-verified

242
243// Get the smallest frame number (or NULL shared_ptr if no frame is found)
244std::shared_ptr<Frame> CacheDisk::GetSmallestFrame()
245{
246 // Create a scoped lock, to protect the cache from multiple threads
247 const std::lock_guard<std::recursive_mutex> lock(*cacheMutex);
248
249 // Loop through frame numbers
250 std::deque<int64_t>::iterator itr;
251 int64_t smallest_frame = -1;
252 for(itr = frame_numbers.begin(); itr != frame_numbers.end(); ++itr)
253 {
254 if (*itr < smallest_frame || smallest_frame == -1)
255 smallest_frame = *itr;
256 }
257
258 // Return frame (if any)
259 if (smallest_frame != -1) {
260 return GetFrame(smallest_frame);
261 } else {
262 return NULL;
263 }
264}
265
266// Gets the maximum bytes value
267int64_t CacheDisk::GetBytes()

Callers 1

CacheMemory.cppFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected