提交 42458c2a authored 作者: blu's avatar blu

evmlmotion: delta packet ts

上级 98b691ca
...@@ -148,11 +148,11 @@ error_exit: ...@@ -148,11 +148,11 @@ error_exit:
{ {
auto body = z_recv_multiple(pDealer,false); auto body = z_recv_multiple(pDealer,false);
if(body.size() == 0) { if(body.size() == 0) {
spdlog::error("evslicer {} failed to receive multiple msg: {}", this->devSn, zmq_strerror(zmq_errno())); spdlog::error("evslicer {} failed to receive multiple cloud msg: {}", this->devSn, zmq_strerror(zmq_errno()));
continue; }else{
} // full proto msg received.
// full proto msg received. this->handleCloudMsg(body);
this->handleCloudMsg(body); }
} }
}); });
thCloudMsgHandler.detach(); thCloudMsgHandler.detach();
......
...@@ -823,11 +823,11 @@ public: ...@@ -823,11 +823,11 @@ public:
{ {
auto body = z_recv_multiple(pDaemon,false); auto body = z_recv_multiple(pDaemon,false);
if(body.size() == 0) { if(body.size() == 0) {
spdlog::error("evslicer {} failed to receive multiple msg: {}", selfId, zmq_strerror(zmq_errno())); spdlog::error("evslicer {} failed to receive multiple cloud msg: {}", selfId, zmq_strerror(zmq_errno()));
continue; }else{
// full proto msg received.
this->handleCloudMsg(body);
} }
// full proto msg received.
this->handleCloudMsg(body);
} }
}); });
thCloudMsgHandler.detach(); thCloudMsgHandler.detach();
...@@ -837,11 +837,11 @@ public: ...@@ -837,11 +837,11 @@ public:
{ {
auto body = z_recv_multiple(pDealer,false); auto body = z_recv_multiple(pDealer,false);
if(body.size() == 0) { if(body.size() == 0) {
spdlog::error("evslicer {} failed to receive multiple msg: {}", selfId, zmq_strerror(zmq_errno())); spdlog::error("evslicer {} failed to receive multiple edge msg: {}", selfId, zmq_strerror(zmq_errno()));
continue; }else{
// full proto msg received.
this->handleEdgeMsg(body);
} }
// full proto msg received.
this->handleEdgeMsg(body);
} }
}); });
thEdgeMsgHandler.detach(); thEdgeMsgHandler.detach();
......
...@@ -308,6 +308,7 @@ protected: ...@@ -308,6 +308,7 @@ protected:
{ {
int ret = 0; int ret = 0;
AVDictionary * optsIn = nullptr; AVDictionary * optsIn = nullptr;
av_dict_set_int(&optsIn, "stimeout", (int64_t)(1000* 1000 * 1), 0);
string proto = urlIn.substr(0,4); string proto = urlIn.substr(0,4);
if(proto == "rtsp") { if(proto == "rtsp") {
av_dict_set(&optsIn, "rtsp_transport", "tcp", 0); av_dict_set(&optsIn, "rtsp_transport", "tcp", 0);
...@@ -388,7 +389,7 @@ protected: ...@@ -388,7 +389,7 @@ protected:
ret = av_read_frame(pAVFormatInput, &packet); ret = av_read_frame(pAVFormatInput, &packet);
if (ret < 0) { if (ret < 0) {
spdlog::error("evpuller {} failed read packet: {}", selfId, av_err2str(ret)); spdlog::error("evpuller {} failed read packet: {}", selfId, av_err2str(ret));
break; exit(1);
} }
in_stream = pAVFormatInput->streams[packet.stream_index]; in_stream = pAVFormatInput->streams[packet.stream_index];
if (packet.stream_index >= numStreams || streamList[packet.stream_index] < 0) { if (packet.stream_index >= numStreams || streamList[packet.stream_index] < 0) {
...@@ -469,16 +470,17 @@ public: ...@@ -469,16 +470,17 @@ public:
{ {
auto body = z_recv_multiple(pDealer,false); auto body = z_recv_multiple(pDealer,false);
if(body.size() == 0) { if(body.size() == 0) {
spdlog::error("evslicer {} failed to receive multiple msg: {}", selfId, zmq_strerror(zmq_errno())); spdlog::error("evslicer {} failed to receive multiple cloud msg: {}", selfId, zmq_strerror(zmq_errno()));
continue; }else{
} // full proto msg received.
// full proto msg received. string msg;
string msg; for(auto &v: body) {
for(auto &v: body) { msg += body2str(v) + ",";
msg += body2str(v) + ","; }
spdlog::info("evpuller {} received edge msg: {}", selfId, msg);
this->handleEdgeMsg(body);
} }
spdlog::info("evpuller {} received edge msg: {}", selfId, msg);
this->handleEdgeMsg(body);
} }
}); });
thEdgeMsgHandler.detach(); thEdgeMsgHandler.detach();
...@@ -489,11 +491,11 @@ public: ...@@ -489,11 +491,11 @@ public:
{ {
auto body = z_recv_multiple(pDaemon,false); auto body = z_recv_multiple(pDaemon,false);
if(body.size() == 0) { if(body.size() == 0) {
spdlog::error("evslicer {} failed to receive multiple msg: {}", selfId, zmq_strerror(zmq_errno())); spdlog::error("evslicer {} failed to receive multiple edge msg: {}", selfId, zmq_strerror(zmq_errno()));
continue; }else{
// full proto msg received.
this->handleCloudMsg(body);
} }
// full proto msg received.
this->handleCloudMsg(body);
} }
}); });
thCloudMsgHandler.detach(); thCloudMsgHandler.detach();
......
...@@ -318,6 +318,7 @@ private: ...@@ -318,6 +318,7 @@ private:
spdlog::error("evpusher {} {} failed set output pOptsRemux", devSn, iid); spdlog::error("evpusher {} {} failed set output pOptsRemux", devSn, iid);
ret = AVERROR_UNKNOWN; ret = AVERROR_UNKNOWN;
} }
av_dict_set_int(&pOptsRemux, "stimeout", (int64_t)(1000* 1000 * 1), 0);
ret = avformat_alloc_output_context2(&pAVFormatRemux, nullptr, "rtsp", urlOut.c_str()); ret = avformat_alloc_output_context2(&pAVFormatRemux, nullptr, "rtsp", urlOut.c_str());
} }
else if(proto == "rtmp") { else if(proto == "rtmp") {
...@@ -383,6 +384,7 @@ private: ...@@ -383,6 +384,7 @@ private:
ret = avformat_write_header(pAVFormatRemux, &pOptsRemux); ret = avformat_write_header(pAVFormatRemux, &pOptsRemux);
if (ret < 0) { if (ret < 0) {
spdlog::error("evpusher {} {} error occurred when opening output file", devSn, iid); spdlog::error("evpusher {} {} error occurred when opening output file", devSn, iid);
exit(1);
} }
return ret; return ret;
...@@ -472,9 +474,9 @@ protected: ...@@ -472,9 +474,9 @@ protected:
av_packet_unref(&packet); av_packet_unref(&packet);
if (ret < 0) { if (ret < 0) {
spdlog::error("evpusher {} error muxing packet: {}, {}, {}, {}, restreaming...", selfId, av_err2str(ret), packet.dts, packet.pts, packet.dts==AV_NOPTS_VALUE); spdlog::error("evpusher {} error muxing packet: {}, {}, {}, {}, restreaming...", selfId, av_err2str(ret), packet.dts, packet.pts, packet.dts==AV_NOPTS_VALUE);
if(pktCnt != 0 && packet.pts == AV_NOPTS_VALUE) { if(packet.pts == AV_NOPTS_VALUE) {
// reset // reset
av_write_trailer(pAVFormatRemux); // av_write_trailer(pAVFormatRemux);
freeStream(); freeStream();
getInputFormat(); getInputFormat();
setupStream(); setupStream();
...@@ -532,11 +534,11 @@ public: ...@@ -532,11 +534,11 @@ public:
{ {
auto body = z_recv_multiple(pDaemon,false); auto body = z_recv_multiple(pDaemon,false);
if(body.size() == 0) { if(body.size() == 0) {
spdlog::error("evslicer {} failed to receive multiple msg: {}", selfId, zmq_strerror(zmq_errno())); spdlog::error("evslicer {} failed to receive multiple cloud msg: {}", selfId, zmq_strerror(zmq_errno()));
continue; }else{
} // full proto msg received.
// full proto msg received. this->handleCloudMsg(body);
this->handleCloudMsg(body); }
} }
}); });
thCloudMsgHandler.detach(); thCloudMsgHandler.detach();
...@@ -546,11 +548,11 @@ public: ...@@ -546,11 +548,11 @@ public:
{ {
auto body = z_recv_multiple(pDealer,false); auto body = z_recv_multiple(pDealer,false);
if(body.size() == 0) { if(body.size() == 0) {
spdlog::error("evslicer {} failed to receive multiple msg: {}", selfId, zmq_strerror(zmq_errno())); spdlog::error("evslicer {} failed to receive multiple edge msg: {}", selfId, zmq_strerror(zmq_errno()));
continue; }else{
} // full proto msg received.
// full proto msg received. this->handleEdgeMsg(body);
this->handleEdgeMsg(body); }
} }
}); });
thEdgeMsgHandler.detach(); thEdgeMsgHandler.detach();
...@@ -588,7 +590,7 @@ public: ...@@ -588,7 +590,7 @@ public:
zmq_close(pDaemon); zmq_close(pDaemon);
pDaemon = nullptr; pDaemon = nullptr;
} }
if(pDaemonCtx != nullptr) { if(pDaemonCtx != nullptr) {
zmq_ctx_destroy(pDaemonCtx); zmq_ctx_destroy(pDaemonCtx);
pDaemonCtx = nullptr; pDaemonCtx = nullptr;
......
...@@ -883,11 +883,12 @@ public: ...@@ -883,11 +883,12 @@ public:
while(true) { while(true) {
auto body = z_recv_multiple(pDealer,false); auto body = z_recv_multiple(pDealer,false);
if(body.size() == 0) { if(body.size() == 0) {
spdlog::error("evslicer {} failed to receive multiple msg: {}", selfId, zmq_strerror(zmq_errno())); spdlog::error("evslicer {} failed to receive multiple edge msg: {}", selfId, zmq_strerror(zmq_errno()));
continue; }else{
// full proto msg received.
handleEdgeMsg(body);
} }
// full proto msg received.
handleEdgeMsg(body);
} }
}); });
thEdgeMsgHandler.detach(); thEdgeMsgHandler.detach();
...@@ -897,11 +898,11 @@ public: ...@@ -897,11 +898,11 @@ public:
{ {
auto body = z_recv_multiple(pDaemon,false); auto body = z_recv_multiple(pDaemon,false);
if(body.size() == 0) { if(body.size() == 0) {
spdlog::error("evslicer {} failed to receive multiple msg: {}", selfId, zmq_strerror(zmq_errno())); spdlog::error("evslicer {} failed to receive multiple cloud msg: {}", selfId, zmq_strerror(zmq_errno()));
continue; }else{
} // full proto msg received.
// full proto msg received. this->handleCloudMsg(body);
this->handleCloudMsg(body); }
} }
}); });
thCloudMsgHandler.detach(); thCloudMsgHandler.detach();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论