From d72af3e61adfd0c279ff6301c08ccfeab53c0e8c Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sat, 18 Jun 2022 21:19:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E4=B8=8D=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E7=9A=84rtsp=20url:=20#904?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtsp/RtspPlayer.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Rtsp/RtspPlayer.cpp b/src/Rtsp/RtspPlayer.cpp index 4924522b..498196de 100644 --- a/src/Rtsp/RtspPlayer.cpp +++ b/src/Rtsp/RtspPlayer.cpp @@ -491,9 +491,15 @@ void RtspPlayer::onRtpPacket(const char *data, size_t len) { uint8_t interleaved = data[1]; if(interleaved %2 == 0){ trackIdx = getTrackIndexByInterleaved(interleaved); + if (trackIdx == -1) { + return; + } handleOneRtp(trackIdx, _sdp_track[trackIdx]->_type, _sdp_track[trackIdx]->_samplerate, (uint8_t *)data + RtpPacket::kRtpTcpHeaderSize, len - RtpPacket::kRtpTcpHeaderSize); }else{ trackIdx = getTrackIndexByInterleaved(interleaved - 1); + if (trackIdx == -1) { + return; + } onRtcpPacket(trackIdx, _sdp_track[trackIdx], (uint8_t *) data + RtpPacket::kRtpTcpHeaderSize, len - RtpPacket::kRtpTcpHeaderSize); } } @@ -711,7 +717,8 @@ int RtspPlayer::getTrackIndexByInterleaved(int interleaved) const { if (_sdp_track.size() == 1) { return 0; } - throw SockException(Err_shutdown, StrPrinter << "no such track with interleaved:" << interleaved); + WarnL << "no such track with interleaved:" << interleaved; + return -1; } int RtspPlayer::getTrackIndexByTrackType(TrackType track_type) const {