Add deleting sources to RTSPServerThread::Stop(). Delete redundant terminate

This commit is contained in:
Isaac Connor committed 2021-03-05 14:18:51 -05:00
1 parent ebd29a3cb9
commit cfb8e062c1
1 file changed
+8 -2
+8 -2
View File
@@ -12,7 +12,7 @@
#include <StreamReplicator.hh>
RTSPServerThread::RTSPServerThread(int port) :
terminate_(false), scheduler_watch_var_(0)
scheduler_watch_var_(0)
{
//unsigned short rtsp_over_http_port = 0;
//const char *realm = "ZoneMinder";
@@ -64,7 +64,6 @@ void RTSPServerThread::Run() {
void RTSPServerThread::Stop() {
Debug(1, "RTSPServerThread::stop()");
terminate_ = true;
{
std::lock_guard<std::mutex> lck(scheduler_watch_var_mutex_);
@@ -72,8 +71,15 @@ void RTSPServerThread::Stop() {
}
for ( std::list<FramedSource *>::iterator it = sources.begin(); it != sources.end(); ++it ) {
Debug(1, "RTSPServerThread::stopping source");
(*it)->stopGettingFrames();
}
while ( sources.size() ) {
Debug(1, "RTSPServerThread::stop closing source");
FramedSource *source = sources.front();
sources.pop_front();
Medium::close(source);
}
}
ServerMediaSession *RTSPServerThread::addSession(std::string &streamname) {