From e81ff307c7ce172d97378df05bf240f4bae94b8a Mon Sep 17 00:00:00 2001 From: xia-chu <771730766@qq.com> Date: Sat, 25 Nov 2023 21:43:16 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=B2=E6=AD=A2=E5=8F=91=E9=80=81=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=88=B3=E9=83=BD=E4=B8=BA0=E7=9A=84sr=20rtcp?= =?UTF-8?q?=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtsp/RtspPusher.cpp | 5 ++++- src/Rtsp/RtspSession.cpp | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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