From cfb8e062c17087f8f49b604474a70da4eab790a9 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 5 Mar 2021 14:18:51 -0500 Subject: [PATCH] Add deleting sources to RTSPServerThread::Stop(). Delete redundant terminate --- src/zm_rtsp_server_thread.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/zm_rtsp_server_thread.cpp b/src/zm_rtsp_server_thread.cpp index c337d669f..c8fdd9fdb 100644 --- a/src/zm_rtsp_server_thread.cpp +++ b/src/zm_rtsp_server_thread.cpp @@ -12,7 +12,7 @@ #include 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 lck(scheduler_watch_var_mutex_); @@ -72,8 +71,15 @@ void RTSPServerThread::Stop() { } for ( std::list::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) {