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

big refacting of communitation architect

上级 d7ad5c00
...@@ -317,6 +317,7 @@ protected: ...@@ -317,6 +317,7 @@ protected:
AVPacket packet; AVPacket packet;
uint64_t pktCnt = 0; uint64_t pktCnt = 0;
int pktIgnore = 0; int pktIgnore = 0;
int64_t lastPts = 0;
while (true) { while (true) {
ret =zmq_msg_init(&msg); ret =zmq_msg_init(&msg);
if(ret != 0) { if(ret != 0) {
...@@ -345,11 +346,11 @@ protected: ...@@ -345,11 +346,11 @@ protected:
} }
zmq_msg_close(&msg); zmq_msg_close(&msg);
if(pktCnt == 0 && pktIgnore < 18*7) { // if(pktCnt == 0 && packet.stream_index != 0) {
pktIgnore++; // pktIgnore++;
av_packet_unref(&packet); // av_packet_unref(&packet);
continue; // continue;
} // }
spdlog::debug("packet stream indx: {:d}", packet.stream_index); spdlog::debug("packet stream indx: {:d}", packet.stream_index);
// relay // relay
...@@ -359,18 +360,20 @@ protected: ...@@ -359,18 +360,20 @@ protected:
out_stream = pAVFormatRemux->streams[packet.stream_index]; out_stream = pAVFormatRemux->streams[packet.stream_index];
/* copy packet */ /* copy packet */
if(pktCnt == 0) { // spdlog::info("evpusher {} packet pts: {} dts: {}", selfId, packet.pts, packet.dts);
packet.pts = 0; // if(pktCnt == 0) {
packet.dts = 0; // packet.pts = AV_NOPTS_VALUE;
packet.duration = 0; // packet.dts = AV_NOPTS_VALUE;
packet.pos = -1; // packet.duration = 0;
} // packet.pos = -1;
else { // }else{
packet.pts = av_rescale_q_rnd(packet.pts, in_stream->time_base, out_stream->time_base, (AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX)); // packet.pts = av_rescale_q_rnd(packet.pts, in_stream->time_base, out_stream->time_base, (AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));
packet.dts = av_rescale_q_rnd(packet.dts, in_stream->time_base, out_stream->time_base, (AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX)); // packet.dts = av_rescale_q_rnd(packet.dts, in_stream->time_base, out_stream->time_base, (AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));
packet.duration = av_rescale_q(packet.duration, in_stream->time_base, out_stream->time_base); // packet.duration = av_rescale_q(packet.duration, in_stream->time_base, out_stream->time_base);
packet.pos = -1; // packet.pos = -1;
} // lastPts = packet.dts;
// }
// spdlog::info("evpusher {} packet new pts: {} dts: {}", selfId, packet.pts, packet.dts);
ret = av_interleaved_write_frame(pAVFormatRemux, &packet); ret = av_interleaved_write_frame(pAVFormatRemux, &packet);
av_packet_unref(&packet); av_packet_unref(&packet);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论