提交 035af9c8 authored 作者: blu's avatar blu

schimittrigger

上级 01b1ca70
...@@ -486,16 +486,30 @@ private: ...@@ -486,16 +486,30 @@ private:
); );
// string name = urlOut + "/"+ to_string(chrono::duration_cast<chrono::seconds>(chrono::system_clock::now().time_since_epoch()).count()) + ".pgm"; // string name = urlOut + "/"+ to_string(chrono::duration_cast<chrono::seconds>(chrono::system_clock::now().time_since_epoch()).count()) + ".pgm";
// TODO: dynamic pps adapting // TODO: dynamic pps adapting
if(this->schmittriStatus == 0 && this->pktLag >= 10) { // if(this->schmittriStatus == 0 && this->pktLag >= 10) {
this->schmittriStatus = 1; // this->schmittriStatus = 1;
}else if(this->schmittriStatus == 1 && this->pktLag <= 5){ // }else if(this->schmittriStatus == 1 && this->pktLag <= 5){
this->schmittriStatus = 2; // this->schmittriStatus = 2;
}else if(this->schmittriStatus == 2 && this->pktLag < 10) { // }else if(this->schmittriStatus == 2 && this->pktLag < 10) {
this->schmittriStatus = 0; // this->schmittriStatus = 0;
// }
static long long called = 0;
called++;
int factor = 0;
bool proc = true;
if(this->pps != 0) {
factor = int(int(this->pps) / this->detPara.fpsProc);
}
if(factor != 0 ){
if(called % factor == 0) {
proc = true;
}else{
proc = false;
}
} }
if(this->pps < this->detPara.fpsProc|| this->schmittriStatus != 0) { if(this->pps < this->detPara.fpsProc || !proc) {
if(this->pps != 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 {}, parProc {}, lag {}, skip processing", this->selfId, this->pps, this->detPara.fpsProc, this->pktLag);
} }
detectMotion(pCodecContext->pix_fmt, pFrame, false); detectMotion(pCodecContext->pix_fmt, pFrame, false);
...@@ -793,17 +807,17 @@ protected: ...@@ -793,17 +807,17 @@ protected:
spdlog::error("evmlmotion error muxing packet"); spdlog::error("evmlmotion error muxing packet");
} }
if((pktCnt - pktCntLast ) == 180) { if((pktCnt - pktCntLast ) == 18) {
auto now = chrono::system_clock::now(); auto now = chrono::system_clock::now();
auto delta = chrono::duration_cast<chrono::seconds>(now - start).count(); auto delta = chrono::duration_cast<chrono::milliseconds>(now - start).count();
pktLag = chrono::duration_cast<chrono::seconds>(now.time_since_epoch()).count() - this->packetTs; pktLag = chrono::duration_cast<chrono::seconds>(now.time_since_epoch()).count() - this->packetTs;
this->pps = 180.0/delta; this->pps = 18.0 * 1000/delta;
if(pktCnt % (180 * 5) == 0) { if(pktCnt % (180 * 5) == 0) {
spdlog::info("evmlmotion {} metering: 180 packet in {}s, pps: {}, lag:{}", selfId, delta, pps, pktLag); spdlog::info("evmlmotion {} metering: 18 packet in {}s, pps: {}, lag:{}", selfId, delta, pps, pktLag);
} }
pktCntLast = pktCnt; pktCntLast = pktCnt;
start = chrono::system_clock::now(); start = now;
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论