From 1b6e61c4130a976c5f77de59dc398ff59102fdf3 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Mon, 11 Nov 2019 19:03:03 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E5=A4=8D#125=202=E3=80=81?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=9D=9E=E6=B3=95rtsp=20url=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rdpart/ZLToolKit | 2 +- src/Rtsp/RtspPlayer.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/3rdpart/ZLToolKit b/3rdpart/ZLToolKit index 0ac7b3b1..442fb18d 160000 --- a/3rdpart/ZLToolKit +++ b/3rdpart/ZLToolKit @@ -1 +1 @@ -Subproject commit 0ac7b3b1dc9817de1b1bb8644e2799ca0e4e9472 +Subproject commit 442fb18d2c13de4d5ac005c6d286e3e2b73309eb diff --git a/src/Rtsp/RtspPlayer.cpp b/src/Rtsp/RtspPlayer.cpp index bd3b83b9..be1424d6 100644 --- a/src/Rtsp/RtspPlayer.cpp +++ b/src/Rtsp/RtspPlayer.cpp @@ -105,7 +105,7 @@ void RtspPlayer::play(const string &strUrl){ } void RtspPlayer::play(bool isSSL,const string &strUrl, const string &strUser, const string &strPwd, Rtsp::eRtpType eType ) { - DebugL << strUrl << " " + DebugL << strUrl << " " << (strUser.size() ? strUser : "null") << " " << (strPwd.size() ? strPwd:"null") << " " << eType; @@ -122,7 +122,7 @@ void RtspPlayer::play(bool isSSL,const string &strUrl, const string &strUser, co _eType = eType; auto ip = FindField(strUrl.data(), "://", "/"); - if (!ip.size()) { + if (ip.empty()) { ip = split(FindField(strUrl.data(), "://", NULL),"?")[0]; } auto port = atoi(FindField(ip.data(), ":", NULL).data()); @@ -134,6 +134,11 @@ void RtspPlayer::play(bool isSSL,const string &strUrl, const string &strUser, co ip = FindField(ip.data(), NULL, ":"); } + if(ip.empty()){ + onPlayResult_l(SockException(Err_other,StrPrinter << "illegal rtsp url:" << strUrl)); + return; + } + _strUrl = strUrl; weak_ptr weakSelf = dynamic_pointer_cast(shared_from_this());