Skip to content

Commit

Permalink
release from live555 mainloop
Browse files Browse the repository at this point in the history
  • Loading branch information
mpromonet committed Mar 23, 2024
1 parent 75f1449 commit 828986f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions inc/rtspconnectionclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class RTSPConnection

protected:
TASK_CALLBACK(RTSPConnection,startCallback);
TASK_CALLBACK(RTSPConnection,stopCallback);

protected:
Environment& m_env;
Expand Down
12 changes: 11 additions & 1 deletion src/rtspconnectionclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

RTSPConnection::RTSPConnection(Environment& env, Callback* callback, const char* rtspURL, int timeout, int rtptransport, int verbosityLevel)
: m_startCallbackTask(NULL)
, m_stopCallbackTask(NULL)
, m_env(env)
, m_callback(callback)
, m_url(rtspURL)
Expand All @@ -30,6 +31,7 @@ RTSPConnection::RTSPConnection(Environment& env, Callback* callback, const char*

RTSPConnection::RTSPConnection(Environment& env, Callback* callback, const char* rtspURL, const std::map<std::string,std::string> & opts, int verbosityLevel)
: m_startCallbackTask(NULL)
, m_stopCallbackTask(NULL)
, m_env(env)
, m_callback(callback)
, m_url(rtspURL)
Expand All @@ -43,6 +45,7 @@ RTSPConnection::RTSPConnection(Environment& env, Callback* callback, const char*
void RTSPConnection::start(unsigned int delay)
{
m_env.taskScheduler().unscheduleDelayedTask(m_startCallbackTask);
m_env.taskScheduler().unscheduleDelayedTask(m_stopCallbackTask);
m_startCallbackTask = m_env.taskScheduler().scheduleDelayedTask(delay*1000000, TaskstartCallback, this);
}

Expand All @@ -55,12 +58,19 @@ void RTSPConnection::TaskstartCallback()
void RTSPConnection::stop()
{
m_env.taskScheduler().unscheduleDelayedTask(m_startCallbackTask);
m_env.taskScheduler().unscheduleDelayedTask(m_stopCallbackTask);
m_stopCallbackTask = m_env.taskScheduler().scheduleDelayedTask(0, TaskstopCallback, this);
}

void RTSPConnection::TaskstopCallback()
{
Medium::close(m_rtspClient);
}

RTSPConnection::~RTSPConnection()
{
stop();
m_env.taskScheduler().unscheduleDelayedTask(m_startCallbackTask);
m_env.taskScheduler().unscheduleDelayedTask(m_stopCallbackTask);
}

int getHttpTunnelPort(int rtptransport, const char* rtspURL)
Expand Down

0 comments on commit 828986f

Please sign in to comment.