diff --git a/src/Rtsp/RtspPusher.cpp b/src/Rtsp/RtspPusher.cpp index 4748fb15..591b082e 100644 --- a/src/Rtsp/RtspPusher.cpp +++ b/src/Rtsp/RtspPusher.cpp @@ -358,7 +358,10 @@ void RtspPusher::updateRtcpContext(const RtpPacket::Ptr &rtp){ auto &ticker = _rtcp_send_ticker[track_index]; auto &rtcp_ctx = _rtcp_context[track_index]; rtcp_ctx->onRtp(rtp->getSeq(), rtp->getStamp(), rtp->ntp_stamp, rtp->sample_rate, rtp->size() - RtpPacket::kRtpTcpHeaderSize); - + if (!rtp->ntp_stamp && !rtp->getStamp()) { + // 忽略时间戳都为0的rtp + return; + } //send rtcp every 5 second if (ticker.elapsedTime() > 5 * 1000) { ticker.resetTime(); diff --git a/src/Rtsp/RtspSession.cpp b/src/Rtsp/RtspSession.cpp index d780a66d..5e8e85ea 100644 --- a/src/Rtsp/RtspSession.cpp +++ b/src/Rtsp/RtspSession.cpp @@ -1193,6 +1193,10 @@ void RtspSession::updateRtcpContext(const RtpPacket::Ptr &rtp){ int track_index = getTrackIndexByTrackType(rtp->type); auto &rtcp_ctx = _rtcp_context[track_index]; rtcp_ctx->onRtp(rtp->getSeq(), rtp->getStamp(), rtp->ntp_stamp, rtp->sample_rate, rtp->size() - RtpPacket::kRtpTcpHeaderSize); + if (!rtp->ntp_stamp && !rtp->getStamp()) { + // 忽略时间戳都为0的rtp + return; + } auto &ticker = _rtcp_send_tickers[track_index]; //send rtcp every 5 second