Commit df7305c6 by 夏楚 Committed by GitHub

Merge pull request #94 from nanguantong/master

添加文件循环读取
parents a65d9f03 67575bb2
...@@ -268,12 +268,16 @@ const string kFilePath = RECORD_FIELD"filePath"; ...@@ -268,12 +268,16 @@ const string kFilePath = RECORD_FIELD"filePath";
//mp4文件写缓存大小 //mp4文件写缓存大小
const string kFileBufSize = RECORD_FIELD"fileBufSize"; const string kFileBufSize = RECORD_FIELD"fileBufSize";
//mp4文件是否重头循环读取
const string kFileRepeat = RECORD_FIELD"fileRepeat";
onceToken token([](){ onceToken token([](){
mINI::Instance()[kAppName] = RECORD_APP_NAME; mINI::Instance()[kAppName] = RECORD_APP_NAME;
mINI::Instance()[kSampleMS] = RECORD_SAMPLE_MS; mINI::Instance()[kSampleMS] = RECORD_SAMPLE_MS;
mINI::Instance()[kFileSecond] = RECORD_FILE_SECOND; mINI::Instance()[kFileSecond] = RECORD_FILE_SECOND;
mINI::Instance()[kFilePath] = RECORD_FILE_PATH; mINI::Instance()[kFilePath] = RECORD_FILE_PATH;
mINI::Instance()[kFileBufSize] = 64 * 1024; mINI::Instance()[kFileBufSize] = 64 * 1024;
mINI::Instance()[kFileRepeat] = false;
},nullptr); },nullptr);
} //namespace Record } //namespace Record
......
...@@ -268,6 +268,8 @@ extern const string kFileSecond; ...@@ -268,6 +268,8 @@ extern const string kFileSecond;
extern const string kFilePath; extern const string kFilePath;
//mp4文件写缓存大小 //mp4文件写缓存大小
extern const string kFileBufSize; extern const string kFileBufSize;
//mp4文件是否重头循环读取
extern const string kFileRepeat;
} //namespace Record } //namespace Record
////////////HLS相关配置/////////// ////////////HLS相关配置///////////
......
...@@ -200,6 +200,11 @@ bool MediaReader::readSample(int iTimeInc,bool justSeekSyncFrame) { ...@@ -200,6 +200,11 @@ bool MediaReader::readSample(int iTimeInc,bool justSeekSyncFrame) {
if((bFlag0 || bFlag1) && bFlag2){ if((bFlag0 || bFlag1) && bFlag2){
_alive.resetTime(); _alive.resetTime();
} }
//重头开始循环读取
GET_CONFIG(bool,fileRepeat,Record::kFileRepeat);
if (fileRepeat && !bFlag0 && !bFlag1) {
seek(0);
}
//DebugL << "alive ..."; //DebugL << "alive ...";
//3秒延时关闭 //3秒延时关闭
return _alive.elapsedTime() < 3 * 1000; return _alive.elapsedTime() < 3 * 1000;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论