From ee6dff8cd4de2042388fc0ba1a411b322ab5c8a9 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 27 Apr 2022 15:16:02 -0400 Subject: [PATCH] Disconnect and Reconnect in PrimeCapture instead of in constructor and descructor. Fixes camera not reconnecting. --- src/zm_remote_camera_rtsp.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/zm_remote_camera_rtsp.cpp b/src/zm_remote_camera_rtsp.cpp index eb4e1c8b8..b8a533fae 100644 --- a/src/zm_remote_camera_rtsp.cpp +++ b/src/zm_remote_camera_rtsp.cpp @@ -103,8 +103,6 @@ void RemoteCameraRtsp::Initialise() { buffer.size(max_size); FFMPEGInit(); - - Connect(); } void RemoteCameraRtsp::Terminate() { @@ -126,6 +124,9 @@ int RemoteCameraRtsp::Disconnect() { } int RemoteCameraRtsp::PrimeCapture() { + if (rtspThread) Disconnect(); + Connect(); + Debug(2, "Waiting for sources"); for (int i = 100; i && !zm_terminate && !rtspThread->hasSources(); i--) { std::this_thread::sleep_for(Microseconds(10000));