Merge pull request #94 from nanguantong/master

添加文件循环读取
This commit is contained in:
夏楚 2019-09-25 09:11:58 +08:00 committed by GitHub
commit df7305c6ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -268,12 +268,16 @@ const string kFilePath = RECORD_FIELD"filePath";
//mp4文件写缓存大小
const string kFileBufSize = RECORD_FIELD"fileBufSize";
//mp4文件是否重头循环读取
const string kFileRepeat = RECORD_FIELD"fileRepeat";
onceToken token([](){
mINI::Instance()[kAppName] = RECORD_APP_NAME;
mINI::Instance()[kSampleMS] = RECORD_SAMPLE_MS;
mINI::Instance()[kFileSecond] = RECORD_FILE_SECOND;
mINI::Instance()[kFilePath] = RECORD_FILE_PATH;
mINI::Instance()[kFileBufSize] = 64 * 1024;
mINI::Instance()[kFileRepeat] = false;
},nullptr);
} //namespace Record

View File

@ -268,6 +268,8 @@ extern const string kFileSecond;
extern const string kFilePath;
//mp4文件写缓存大小
extern const string kFileBufSize;
//mp4文件是否重头循环读取
extern const string kFileRepeat;
} //namespace Record
////////////HLS相关配置///////////

View File

@ -200,6 +200,11 @@ bool MediaReader::readSample(int iTimeInc,bool justSeekSyncFrame) {
if((bFlag0 || bFlag1) && bFlag2){
_alive.resetTime();
}
//重头开始循环读取
GET_CONFIG(bool,fileRepeat,Record::kFileRepeat);
if (fileRepeat && !bFlag0 && !bFlag1) {
seek(0);
}
//DebugL << "alive ...";
//3秒延时关闭
return _alive.elapsedTime() < 3 * 1000;