1、修复#125

2、修复非法rtsp url导致异常的问题
This commit is contained in:
xiongziliang 2019-11-11 19:03:03 +08:00
parent 36a3f4225c
commit 1b6e61c413
2 changed files with 8 additions and 3 deletions

@ -1 +1 @@
Subproject commit 0ac7b3b1dc9817de1b1bb8644e2799ca0e4e9472 Subproject commit 442fb18d2c13de4d5ac005c6d286e3e2b73309eb

View File

@ -122,7 +122,7 @@ void RtspPlayer::play(bool isSSL,const string &strUrl, const string &strUser, co
_eType = eType; _eType = eType;
auto ip = FindField(strUrl.data(), "://", "/"); auto ip = FindField(strUrl.data(), "://", "/");
if (!ip.size()) { if (ip.empty()) {
ip = split(FindField(strUrl.data(), "://", NULL),"?")[0]; ip = split(FindField(strUrl.data(), "://", NULL),"?")[0];
} }
auto port = atoi(FindField(ip.data(), ":", NULL).data()); 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, ":"); ip = FindField(ip.data(), NULL, ":");
} }
if(ip.empty()){
onPlayResult_l(SockException(Err_other,StrPrinter << "illegal rtsp url:" << strUrl));
return;
}
_strUrl = strUrl; _strUrl = strUrl;
weak_ptr<RtspPlayer> weakSelf = dynamic_pointer_cast<RtspPlayer>(shared_from_this()); weak_ptr<RtspPlayer> weakSelf = dynamic_pointer_cast<RtspPlayer>(shared_from_this());