From 8324a9fe438bd96ffc7e938474ea68a229b22432 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Mon, 28 Feb 2022 17:20:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Drtsp=E6=8E=A8=E6=B5=81?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=E7=A9=BA=E6=8C=87=E9=92=88=E7=9A=84bug:#1456?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtsp/RtspSession.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Rtsp/RtspSession.cpp b/src/Rtsp/RtspSession.cpp index 8c504e50..0db04659 100644 --- a/src/Rtsp/RtspSession.cpp +++ b/src/Rtsp/RtspSession.cpp @@ -170,9 +170,6 @@ void RtspSession::onWholeRtspPacket(Parser &parser) { void RtspSession::onRtpPacket(const char *data, size_t len) { uint8_t interleaved = data[1]; if (interleaved % 2 == 0) { - if (!_push_src) { - return; - } auto track_idx = getTrackIndexByInterleaved(interleaved); handleOneRtp(track_idx, _sdp_track[track_idx]->_type, _sdp_track[track_idx]->_samplerate, (uint8_t *) data + RtpPacket::kRtpTcpHeaderSize, len - RtpPacket::kRtpTcpHeaderSize); } else { @@ -950,7 +947,11 @@ void RtspSession::send_NotAcceptable() { } void RtspSession::onRtpSorted(RtpPacket::Ptr rtp, int track_idx) { - _push_src->onWrite(std::move(rtp), false); + if (_push_src) { + _push_src->onWrite(std::move(rtp), false); + } else { + WarnL << "Not a rtsp push!"; + } } void RtspSession::onRcvPeerUdpData(int interleaved, const Buffer::Ptr &buf, const struct sockaddr &addr) {