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

Method Open

framework/data_source/cache/cachedSource.cpp:63–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61 }
62
63 int cachedSource::Open(int flags)
64 {
65 std::lock_guard<std::mutex> uMutex(mMutex);
66
67 if (mIsOpen) {
68 return 0;
69 }
70
71 mDataSource->Set_config(mSourceConfig);
72 int ret = mDataSource->Open(flags);
73
74 if (ret < 0) {
75 return ret;
76 }
77
78 mFileSize = mDataSource->Seek(0, SEEK_SIZE);
79
80 if (mFileSize <= 0) {
81 AF_LOGE("unknown file size can't cache");
82 return -1;
83 }
84
85 mIsOpen = true;
86
87 if (mMaxUsedBufferSize == 0) {
88 mMaxUsedBufferSize = mFileSize;
89 }
90
91// std::lock_guard<std::mutex> uMutex(mMutex);
92 if (mBufferSource) {
93 delete mBufferSource;
94 }
95
96 mBufferSource = new sliceBufferSource((uint64_t) ISliceManager::getManager().getSliceSize(), mMaxUsedBufferSize,
97 (uint64_t) mFileSize, *this, mSliceManager);
98 return 0;
99 }
100
101 void cachedSource::Interrupt(bool bInterrput)
102 {

Callers 2

testSliceBufferFunction · 0.45
mainFunction · 0.45

Calls 3

Set_configMethod · 0.80
getSliceSizeMethod · 0.80
SeekMethod · 0.45

Tested by 2

testSliceBufferFunction · 0.36
mainFunction · 0.36