提交 68470335 authored 作者: blu's avatar blu

evmlmotion fps auto adapting

上级 1a887735
...@@ -196,6 +196,19 @@ error_exit: ...@@ -196,6 +196,19 @@ error_exit:
peerData["status"][selfId] = chrono::duration_cast<chrono::seconds>(chrono::system_clock::now().time_since_epoch()).count(); peerData["status"][selfId] = chrono::duration_cast<chrono::seconds>(chrono::system_clock::now().time_since_epoch()).count();
spdlog::info("evmgr {} peer connected: {}", devSn, selfId); spdlog::info("evmgr {} peer connected: {}", devSn, selfId);
eventConn = true; eventConn = true;
if(cachedMsg.count(selfId) != 0) {
spdlog::info("evmgr {}, send cached msg to {}", devSn, selfId);
while(!cachedMsg[selfId].empty()) {
lock_guard<mutex> lock(cacheLock);
auto v = cachedMsg[selfId].front();
cachedMsg[selfId].pop();
ret = z_send_multiple(pRouter, v);
if(ret < 0) {
spdlog::error("evmgr {} failed to send multiple: {}", devSn, zmq_strerror(zmq_errno()));
}
}
}
} }
else { else {
peerData["status"][selfId] = 0; peerData["status"][selfId] = 0;
...@@ -206,23 +219,6 @@ error_exit: ...@@ -206,23 +219,6 @@ error_exit:
spdlog::error("evmgr {} failed to update localconfig", devSn); spdlog::error("evmgr {} failed to update localconfig", devSn);
} }
// event
// json jEvt;
// jEvt["type"] = EV_MSG_TYPE_CONN_STAT;
// jEvt["gid"] = selfId;
// jEvt["ts"] = chrono::duration_cast<chrono::seconds>(chrono::system_clock::now().time_since_epoch()).count();
// if(eventConn) {
// jEvt["event"] = EV_MSG_EVENT_CONN_CONN;
// }
// else {
// jEvt["event"] = EV_MSG_EVENT_CONN_DISCONN;
// }
// eventQue.push(jEvt.dump());
// if(eventQue.size() > MAX_EVENT_QUEUE_SIZE) {
// eventQue.pop();
// }
return 0; return 0;
} }
else if(body.size() != 4) { else if(body.size() != 4) {
......
...@@ -297,7 +297,14 @@ private: ...@@ -297,7 +297,14 @@ private:
detPara.entropy = evmlmotion["entropy"]; detPara.entropy = evmlmotion["entropy"];
} }
spdlog::info("evmlmotion {} detection params: entropy {}, area {}, thresh {}", selfId, detPara.entropy, detPara.area, detPara.thre); if(evmlmotion.count("fpsProc") == 0|| !evmlmotion["fpsProc"].is_number_integer() ||evmlmotion["fpsProc"] < 0 || evmlmotion["fpsProc"] >= 40) {
spdlog::info("evmlmotion {} invalid fpsProc value. should be in (0, 40) as int, default to {}", selfId, detPara.fpsProc);
}
else {
detPara.fpsProc = evmlmotion["fpsProc"];
}
spdlog::info("evmlmotion {} detection params: entropy {}, area {}, thresh {}, fpsProc {}", selfId, detPara.entropy, detPara.area, detPara.thre, detPara.fpsProc);
// setup sub // setup sub
pSubCtx = zmq_ctx_new(); pSubCtx = zmq_ctx_new();
...@@ -510,7 +517,7 @@ private: ...@@ -510,7 +517,7 @@ private:
if(this->pps < this->detPara.fpsProc || !proc) { if(this->pps < this->detPara.fpsProc || !proc) {
if(this->pps != 0 && called %180 == 0) { if(this->pps != 0 && called %180 == 0) {
spdlog::info("evmlmotion {} pps {}, parProc {}, lag {}, skip processing", this->selfId, this->pps, this->detPara.fpsProc, this->pktLag); spdlog::info("evmlmotion {} pps {}, fpsFactor {}, called {}, lag {}, skip processing", this->selfId, this->pps, factor, called, this->pktLag);
} }
detectMotion(pCodecContext->pix_fmt, pFrame, false); detectMotion(pCodecContext->pix_fmt, pFrame, false);
}else{ }else{
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论