Skip to content

Commit

Permalink
fix crash stopping & starting
Browse files Browse the repository at this point in the history
  • Loading branch information
mpromonet committed Mar 23, 2024
1 parent 828986f commit ca98ba0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions inc/rtspconnectionclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ class RTSPConnection

void start(unsigned int delay = 0);
void stop();
std::string getUrl() { return m_url; }
int getRtpTransport() { return m_rtptransport; }
std::string getUrl() const { return m_url; }
int getRtpTransport() const { return m_rtptransport; }

protected:
TASK_CALLBACK(RTSPConnection,startCallback);
Expand Down
27 changes: 14 additions & 13 deletions src/rtspconnectionclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ void RTSPConnection::stop()
void RTSPConnection::TaskstopCallback()
{
Medium::close(m_rtspClient);
m_rtspClient = NULL;
}

RTSPConnection::~RTSPConnection()
Expand All @@ -79,20 +80,20 @@ int getHttpTunnelPort(int rtptransport, const char* rtspURL)
if (rtptransport == RTSPConnection::RTPOVERHTTP)
{
std::string url = rtspURL;
const char * pattern = "://";
std::size_t pos = url.find(pattern);
if (pos != std::string::npos) {
url.erase(0,pos+strlen(pattern));
}
pos = url.find_first_of("/");
if (pos != std::string::npos) {
url.erase(pos);
}
pos = url.find_first_of(":");
if (pos != std::string::npos) {
const char * pattern = "://";
std::size_t pos = url.find(pattern);
if (pos != std::string::npos) {
url.erase(0,pos+strlen(pattern));
}
pos = url.find_first_of("/");
if (pos != std::string::npos) {
url.erase(pos);
}
pos = url.find_first_of(":");
if (pos != std::string::npos) {
url.erase(0,pos+1);
httpTunnelPort = std::stoi(url);
}
httpTunnelPort = std::stoi(url);
}
}
return httpTunnelPort;
}
Expand Down

0 comments on commit ca98ba0

Please sign in to comment.