提交 37da4ffb authored 作者: blu's avatar blu

revise getModulesOperFromConfDiff and related applications

上级 e5aa682e
...@@ -113,3 +113,6 @@ fmt: ...@@ -113,3 +113,6 @@ fmt:
fswatch: fswatch:
cd vendor/fswatch && ./autogen.sh && ./configure --prefix=$(CURDIR)/vendor && make -j && make install cd vendor/fswatch && ./autogen.sh && ./configure --prefix=$(CURDIR)/vendor && make -j && make install
libcurl:
cd vendor/curl && ./buildconf && ./configure --prefix=$(CURDIR)/vendor && make -j && make install
...@@ -798,7 +798,6 @@ protected: ...@@ -798,7 +798,6 @@ protected:
} }
if(self->bSegFull) { if(self->bSegFull) {
// TODO: backup orignal self->vTsActive[self->segHead]
} }
try { try {
...@@ -985,21 +984,17 @@ public: ...@@ -985,21 +984,17 @@ public:
thCloudMsgHandler.detach(); thCloudMsgHandler.detach();
// TODO: bugfix
// // thread for slicer maintenace
// thSliceMgr = thread([this]() {
// // get old and active slices
// this->vTsActive = this->LoadVideoFiles(this->urlOut, this->hours, this->numSlices, this->vTsOld);
// spdlog::info("evslicer {} will store slice from index: {}", selfId, this->segHead);
// monitor * m = nullptr;
// thread for slicer maintenace // CreateDirMon(&m, this->urlOut, ".mp4", vector<string>(), EvSlicer::fileMonHandler, (void *)this);
thSliceMgr = thread([this]() { // });
// get old and active slices // thSliceMgr.detach();
this->vTsActive = this->LoadVideoFiles(this->urlOut, this->hours, this->numSlices, this->vTsOld);
spdlog::info("evslicer {} will store slice from index: {}", selfId, this->segHead);
monitor * m = nullptr;
CreateDirMon(&m, this->urlOut, ".mp4", vector<string>(), EvSlicer::fileMonHandler, (void *)this);
});
thSliceMgr.detach();
// thread for uploading slices
getInputFormat();
setupStream();
// event thread // event thread
thEventHandler = thread([this] { thEventHandler = thread([this] {
...@@ -1027,6 +1022,14 @@ public: ...@@ -1027,6 +1022,14 @@ public:
long offsetE = 0; long offsetE = 0;
// TODO: async // TODO: async
this->vTsActive = this->LoadVideoFiles(this->urlOut, this->hours, this->numSlices, this->vTsOld);
if(this->segHead == -1) {
spdlog::error("evslicer {} no local video files");
continue;
}
if(tss < this->bootTime) { if(tss < this->bootTime) {
spdlog::warn("evslicer {} should we discard old msg? {} < bootTime {}", selfId, evt, this->bootTime); spdlog::warn("evslicer {} should we discard old msg? {} < bootTime {}", selfId, evt, this->bootTime);
} }
...@@ -1038,13 +1041,12 @@ public: ...@@ -1038,13 +1041,12 @@ public:
sIdx = this->incSegHead(this->segHead); sIdx = this->incSegHead(this->segHead);
eIdx = this->decSegHead(this->segHead); eIdx = this->decSegHead(this->segHead);
}else{ }else{
sIdx = 1; sIdx = 0;
eIdx = this->decSegHead(this->segHead); eIdx = this->decSegHead(this->segHead);
} }
if(sIdx > eIdx || tss > this->vTsActive[eIdx] || tse < this->vTsActive[sIdx]) { if(sIdx > eIdx || tss > this->vTsActive[eIdx] || tse < this->vTsActive[sIdx]) {
spdlog::error("event range ({}, {}) not in local range ({}, {}).", tss, tse, this->vTsActive[sIdx], this->vTsActive[eIdx]); spdlog::error("evslicer {} event range ({}, {}) not in local range ({}, {}).", selfId, tss, tse, this->vTsActive[sIdx], this->vTsActive[eIdx]);
this->debugFilesRing(this->vTsActive);
continue; continue;
} }
...@@ -1053,7 +1055,7 @@ public: ...@@ -1053,7 +1055,7 @@ public:
spdlog::info("evslicer {} wait for {}s to matching event videos", this->selfId, this->seconds + 5); spdlog::info("evslicer {} wait for {}s to matching event videos", this->selfId, this->seconds + 5);
this_thread::sleep_for(chrono::seconds(this->seconds + 5)); this_thread::sleep_for(chrono::seconds(this->seconds + 5));
}else{ }else{
spdlog::info("event range ({}, {}) is in local range ({}, {}).", tss, tse, this->vTsActive[sIdx], this->vTsActive[eIdx]); spdlog::info("evslicer {} event range ({}, {}) is in local range ({}, {}).", selfId, tss, tse, this->vTsActive[sIdx], this->vTsActive[eIdx]);
} }
auto v = findSlicesByRange(tss, tse, offsetS, offsetE); auto v = findSlicesByRange(tss, tse, offsetS, offsetE);
...@@ -1061,7 +1063,6 @@ public: ...@@ -1061,7 +1063,6 @@ public:
spdlog::error("evslicer {} ignore upload videos in range ({}, {})", this->selfId, this->videoFileTs2Name(tss), this->videoFileTs2Name(tse)); spdlog::error("evslicer {} ignore upload videos in range ({}, {})", this->selfId, this->videoFileTs2Name(tss), this->videoFileTs2Name(tse));
} }
else { else {
debugFilesRing(this->vTsActive);
vector<tuple<string, string> > params= {{"startTime", to_string(tss)},{"endTime", to_string(tse)},{"cameraId", ipcSn}, {"headOffset", to_string(offsetS)},{"tailOffset", to_string(offsetE)}}; vector<tuple<string, string> > params= {{"startTime", to_string(tss)},{"endTime", to_string(tse)},{"cameraId", ipcSn}, {"headOffset", to_string(offsetS)},{"tailOffset", to_string(offsetE)}};
vector<string> fileNames; vector<string> fileNames;
string sf; string sf;
...@@ -1086,6 +1087,10 @@ public: ...@@ -1086,6 +1087,10 @@ public:
} }
} }
}); });
// thread for uploading slices
getInputFormat();
setupStream();
}; };
~EvSlicer() ~EvSlicer()
{ {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论