本文整理汇总了C++中Ref::GetOldestFileDiskTimes方法的典型用法代码示例。如果您正苦于以下问题:C++ Ref::GetOldestFileDiskTimes方法的具体用法?C++ Ref::GetOldestFileDiskTimes怎么用?C++ Ref::GetOldestFileDiskTimes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ref
的用法示例。
在下文中一共展示了Ref::GetOldestFileDiskTimes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetNextPathForStream
std::string RecpathConfig::GetNextPathForStream()
{
logD(recpath, _func_);
//m_mutex.lock();
if(m_configs.size() == 0)
{
//m_mutex.unlock();
logD(recpath, _func_, "Config is empty");
return std::string("");
}
else
logD(recpath, _func_, "Config size is ", m_configs.size());
std::string next_path;
while(true)
{
for(ConfigMap::const_iterator it = m_configs.begin(); it != m_configs.end(); ++it)
{
Int64 freeSize = MemoryDispatcher::Instance().GetDiskFreeSizeFromDiskname(it->first);
logD(recpath, _func_, "diskname is ", it->first.c_str());
logD(recpath, _func_, "freeSize is ", freeSize);
if(freeSize > MINFREESIZE)
{
next_path = it->first;
logD(recpath, _func_, "next_path is ", next_path.c_str());
break;
}
}
if(next_path.size())
{
break;
}
else
{
logD(recpath, _func_, "next_path is empty");
}
// cleaning
logD(recpath, _func_, "CLEANING");
ChannelChecker::ChannelFileDiskTimes channelFileDiskTimes;
std::map<std::string, WeakRef<FFmpegStream> >::iterator itFFStream = m_pStreams->begin();
for(itFFStream; itFFStream != m_pStreams->end(); itFFStream++)
{
logD(recpath, _func_, "channel_name = ", itFFStream->first.c_str());
Ref<ChannelChecker> channelChecker = itFFStream->second.getRefPtr()->GetChannelChecker();
std::pair<std::string, ChChDiskTimes> oldestFileDiskTimes = channelChecker->GetOldestFileDiskTimes();
logD(recpath, _func_, "filename = ", oldestFileDiskTimes.first.c_str());
logD(recpath, _func_, "diskname = ", oldestFileDiskTimes.second.diskName.c_str());
logD(recpath, _func_, "beginTime = ", oldestFileDiskTimes.second.times.timeStart);
logD(recpath, _func_, "endTime = ", oldestFileDiskTimes.second.times.timeEnd);
if(oldestFileDiskTimes.first.size())
{
channelFileDiskTimes.insert(oldestFileDiskTimes);
}
}
// find most older file
int minTime = std::numeric_limits<int>::max();
std::string fileName;
std::string diskName;
ChannelChecker::ChannelFileDiskTimes::iterator iter = channelFileDiskTimes.begin();
for(iter; iter != channelFileDiskTimes.end(); iter++)
{
if(minTime > iter->second.times.timeStart)
{
minTime = iter->second.times.timeStart;
fileName = iter->first;
diskName = iter->second.diskName;
}
}
logD(recpath, _func_, "minTime = ", minTime);
logD(recpath, _func_, "minfileName = ", fileName.c_str());
logD(recpath, _func_, "mindiskName = ", diskName.c_str());
// delete it (if filename is not recorded at current time)
StRef<String> dir_name = st_makeString(diskName.c_str());
StRef<String> file_name = st_makeString(fileName.c_str());
StRef<String> full_file_name = st_makeString(dir_name, "/", file_name, ".flv");
if(!MemoryDispatcher::Instance().IsFilenameRecorded(full_file_name->cstr()))
{
Ref<Vfs> vfs = Vfs::createDefaultLocalVfs (dir_name->mem());
StRef<String> const filenameFull = st_makeString(fileName.c_str(), ".flv");
logD(recpath, _func_, "filenameFull to remove = ", filenameFull);
vfs->removeFile (filenameFull->mem());
vfs->removeSubdirsForFilename (filenameFull->mem());
std::string channel_name = fileName.substr(0,fileName.find("/"));
(*m_pStreams)[channel_name].getRefPtr()->GetChannelChecker()->DeleteFromCache(diskName, fileName);
}
else
{
break;
}
//.........这里部分代码省略.........