提交 18e50a85 authored 作者: blu's avatar blu

big refacting of communitation architect

上级 aeb3b869
......@@ -4,3 +4,6 @@
[submodule "opencv-motion-detect/vendor/leveldb"]
path = opencv-motion-detect/vendor/leveldb
url = https://github.com/google/leveldb
[submodule "opencv-motion-detect/vendor/curlpp"]
path = opencv-motion-detect/vendor/curlpp
url = https://github.com/jpbarrette/curlpp
......@@ -400,7 +400,7 @@ private:
spdlog::info("evdaemon {} received cloud config diff: {}\nnew: {}", devSn, this->deltaCfg.dump(4), data.dump());
if(this->deltaCfg.size() != 0 || this->bColdStart) {
this->config = data;
spdlog::info("evadmon {} reloading config from cloud", devSn);
spdlog::info("evdaemon {} reloading config from cloud", devSn);
ret = reloadCfg();
if(ret != 0) {
spdlog::error("evdameon {} failed to parse new config: {}", devSn, data.dump());
......
......@@ -56,13 +56,12 @@ private:
int ret = 0;
json jret;
bool inited = false;
spdlog::info("evmgr boot {}", devSn);
int opt_notify = ZMQ_NOTIFY_DISCONNECT|ZMQ_NOTIFY_CONNECT;
string addr;
try {
//
spdlog::info("evmgr {} starting with configuration:{}", devSn, config.dump());
spdlog::info("evmgr boot configuration: {} -> {}", devSn, config.dump());
if(config["proto"] != "zmq") {
spdlog::warn("evmgr {} unsupported protocol: {}, try fallback to zmq instead now...", devSn, config["proto"].get<string>());
......
......@@ -89,11 +89,10 @@ private:
int init()
{
int ret = 0;
spdlog::info("evmlmotion boot {}", selfId);
// TODO: req config
bool found = false;
try {
spdlog::info("evmlmotion {} config: {}", devSn, config.dump());
spdlog::info("evmlmotion boot config: {} -> {}", selfId, config.dump());
json evmlmotion;
json &evmgr = this->config;
json ipc;
......@@ -623,7 +622,7 @@ protected:
}
zmq_msg_close(&msg);
if(pktCnt % EV_LOG_PACKET_CNT == 0) {
spdlog::info("seq: {}, pts: {}, dts: {}, idx: {}", pktCnt, packet.pts, packet.dts, packet.stream_index);
spdlog::info("evmlmotion {} seq: {}, pts: {}, dts: {}, idx: {}", selfId, pktCnt, packet.pts, packet.dts, packet.stream_index);
}
pktCnt++;
......@@ -712,7 +711,7 @@ public:
int main(int argc, const char *argv[])
{
spdlog::set_level(spdlog::level::debug);
spdlog::set_level(spdlog::level::info);
av_log_set_level(AV_LOG_ERROR);
queue<string> evtQueue;
EvMLMotion es(&evtQueue);
......@@ -736,7 +735,7 @@ int main(int argc, const char *argv[])
while(true) {
if(evtQueue.size() > 0) {
string p = evtQueue.front();
spdlog::info("event: {}", p);
spdlog::info("evmlmotion event: {}", p);
evtQueue.pop();
}
else {
......
......@@ -145,13 +145,10 @@ private:
{
bool inited = false;
int ret = 0;
spdlog::info("evpuller: {}", selfId);
bool found = false;
string user, passwd, addr;
try {
spdlog::info("config dump: {:s}", config.dump());
spdlog::info("evpuller boot config: {} -> {}", selfId, config.dump());
json evpuller;
json &evmgr = this->config;
json ipc;
......@@ -237,7 +234,7 @@ private:
}
inited = true;
spdlog::info("successfully load config");
spdlog::info("evpuller successfully load config");
return 0;
}
......@@ -309,7 +306,7 @@ protected:
ret = av_read_frame(pAVFormatInput, &packet);
if (ret < 0) {
spdlog::error("failed read packet: {}", av_err2str(ret));
spdlog::error("evpuller {} failed read packet: {}", selfId, av_err2str(ret));
break;
}
in_stream = pAVFormatInput->streams[packet.stream_index];
......@@ -318,7 +315,7 @@ protected:
continue;
}
if(pktCnt % EV_LOG_PACKET_CNT == 0) {
spdlog::info("pktCnt: {:d}", pktCnt);
spdlog::info("evpuller {} pktCnt: {:d}", selfId, pktCnt);
}
pktCnt++;
......@@ -405,7 +402,7 @@ public:
int main(int argc, char **argv)
{
av_log_set_level(AV_LOG_ERROR);
spdlog::set_level(spdlog::level::debug);
spdlog::set_level(spdlog::level::info);
//DB::exec(NULL, NULL, NULL,NULL);
auto evp = EvPuller();
evp.join();
......
......@@ -54,10 +54,9 @@ private:
int init()
{
int ret = 0;
spdlog::info("evpusher startup {}", selfId);
bool found = false;
try {
spdlog::info("config: {:s}", config.dump());
spdlog::info("evpusher boot config: {} -> {}", selfId, config.dump());
json evpusher;
json &evmgr = this->config;
json ipc;
......@@ -131,7 +130,7 @@ private:
if(ret < 0) {
spdlog::error("evpusher {} failed to set config: {}", selfId, config.dump());
}
spdlog::info("new config: {}", config.dump());
spdlog::info("evpusher new config: {}", config.dump());
ping();
}
catch(exception &e) {
......@@ -262,7 +261,7 @@ private:
}
for(int i = 0; i < pAVFormatInput->nb_streams; i++ ) {
spdlog::info("streamList[{:d}]: {:d}", i, streamList[i]);
spdlog::info("evpusher {} streamList[{:d}]: {:d}", selfId, i, streamList[i]);
}
av_dump_format(pAVFormatRemux, 0, urlOut.c_str(), 1);
......@@ -341,7 +340,7 @@ protected:
}
if(pktCnt % EV_LOG_PACKET_CNT == 0) {
spdlog::info("seq: {}, pts: {}, dts: {}, idx: {}", pktCnt, packet.pts, packet.dts, packet.stream_index);
spdlog::info("evpusher {} seq: {}, pts: {}, dts: {}, idx: {}", selfId, pktCnt, packet.pts, packet.dts, packet.stream_index);
}
pktCnt++;
......
......@@ -32,6 +32,7 @@ namespace fs = std::filesystem;
#include "inc/tinythread.hpp"
#include "inc/common.hpp"
#include "inc/database.h"
#include "postfile.h"
using namespace std;
using namespace zmqhelper;
......@@ -62,13 +63,9 @@ private:
int init()
{
int ret = 0;
spdlog::info("evslicer boot {}", selfId);
// TODO: req config
bool found = false;
try {
spdlog::info("config: {:s}", config.dump());
spdlog::info("evslicer boot config: {} -> {}", selfId, config.dump());
json evslicer;
json &evmgr = this->config;
json ipc;
......@@ -130,7 +127,7 @@ private:
sliceIdxToName = new vector<int>(numSlices);
// TODO: load db
// DB::exec(NULL, "select id, ts, last from slices;", DB::get_slices, sliceIdxToName);
spdlog::info("mkdir -p {}", urlOut);
spdlog::info("evslicer mkdir -p {}", selfId, urlOut);
ret = system((string("mkdir -p ") + urlOut).c_str());
// if(ret == -1) {
// spdlog::error("failed to create {} dir", urlOut);
......@@ -280,7 +277,7 @@ private:
}
for(int i = 0; i < pAVFormatInput->nb_streams; i++ ) {
spdlog::info("streamList[{:d}]: {:d}", i, streamList[i]);
spdlog::info("evslicer {} streamList[{:d}]: {:d}", selfId, i, streamList[i]);
}
//av_dict_set(&pOptsRemux, "movflags", "frag_keyframe+empty_moov+default_base_moof", 0);
......@@ -357,7 +354,7 @@ protected:
// TODO:
spdlog::info("writing new slice {}", name.c_str());
spdlog::info("evslicer {} writing new slice {}", selfId, name.c_str());
while(chrono::duration_cast<chrono::seconds>(end-start).count() < minutes * 60) {
if(checkStop() == true) {
bStopSig = true;
......@@ -393,7 +390,7 @@ protected:
//calc pts
if(pktCnt % EV_LOG_PACKET_CNT == 0) {
spdlog::info("seq: {}, pts: {}, dts: {}, idx: {}", pktCnt, packet.pts, packet.dts, packet.stream_index);
spdlog::info("evslicer {} seq: {}, pts: {}, dts: {}, idx: {}", selfId, pktCnt, packet.pts, packet.dts, packet.stream_index);
}
/* copy packet */
if(pktCnt == 0) {
......@@ -504,7 +501,7 @@ public:
int main(int argc, const char *argv[])
{
av_log_set_level(AV_LOG_ERROR);
spdlog::set_level(spdlog::level::debug);
spdlog::set_level(spdlog::level::info);
EvSlicer es;
es.join();
return 0;
......
......@@ -191,7 +191,7 @@ int encode(AVFormatContext *ctx, char **bytes)
wholeSize += strlen(PS_MARK_S);
// num streams
wholeSize += sizeof(ctx->nb_streams);
spdlog::info("encode num of streams: {:d}", ctx->nb_streams);
spdlog::debug("encode num of streams: {:d}", ctx->nb_streams);
for (int i = 0; i < ctx->nb_streams; i++)
{
wholeSize += sizeof(AVStream);
......@@ -246,7 +246,7 @@ int decode(char *bytes, int len, AVFormatContext *pCtx)
spdlog::error("invalid avformatctx: {} {}", ret, len);
return -1;
}
spdlog::info("decode len: {}", ret);
spdlog::debug("decode len: {}", ret);
got += strlen(PS_MARK_S);
memcpy(&ret, bytes + got, sizeof(ret));
got += sizeof(ret);
......
Subproject commit 8810334c830faa3b38bcd94f5b1ab695a4f05eb9
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论