MCPcopy Create free account
hub / github.com/alibaba/CicadaPlayer / getBuffer

Method getBuffer

framework/data_source/cache/memPool.cpp:26–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24 }
25
26 uint8_t *fixSizePool::getBuffer()
27 {
28 std::lock_guard<std::mutex> lock(mMutex);
29 uint8_t *buffer = nullptr;
30
31 if (!mBufferQueue.empty()) {
32 buffer = mBufferQueue.front();
33 mBufferQueue.pop_front();
34 return buffer;
35 }
36
37 if (mAllocedCount >= mBufferNum) {
38 return nullptr;
39 }
40
41 buffer = new uint8_t[mBufferSize];
42 mAllocedCount++;
43 return buffer;
44 }
45
46 void fixSizePool::releaseBuffer(uint8_t *buffer)
47 {

Callers 3

~ISliceManagerMethod · 0.45
getSliceMethod · 0.45
returnSliceMethod · 0.45

Calls 2

frontMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected