From 16312a93f551e43542fdb5097e25e18065c1aba8 Mon Sep 17 00:00:00 2001 From: Zii Date: Thu, 1 Jun 2023 16:59:37 -0400 Subject: [PATCH] v3.0.t12 -added a termination slot to RecLoop that will kill the long term ffmpeg commands and connected it to 'aboutToQuit' signal. this is expected to kill the ffmpeg commands properly when quiting the main process. --- src/camera.cpp | 18 ++++++++++++------ src/camera.h | 4 ++++ src/common.h | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/camera.cpp b/src/camera.cpp index 88ca9ee..3e7dddc 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -116,6 +116,8 @@ void RecLoop::init() recProc = new QProcess(this); imgProc = new QProcess(this); + connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, &RecLoop::term); + Loop::init(); } @@ -155,18 +157,22 @@ void RecLoop::updateCmd() recLog("img_args_updated: " + imgArgs.join(" "), shared); } +void RecLoop::term() +{ + recProc->kill(); + recProc->waitForFinished(); + + imgProc->kill(); + imgProc->waitForFinished(); +} + void RecLoop::reset() { recLog("--rec_and_img_cmds_resetting--", shared); baseListRdy = false; - recProc->kill(); - recProc->waitForFinished(); - - imgProc->kill(); - imgProc->waitForFinished(); - + term(); updateCmd(); } diff --git a/src/camera.h b/src/camera.h index 2cb2abc..62febf7 100644 --- a/src/camera.h +++ b/src/camera.h @@ -79,6 +79,10 @@ private slots: void init(); +public slots: + + void term(); + public: explicit RecLoop(shared_t *shared, QThread *thr, QObject *parent = nullptr); diff --git a/src/common.h b/src/common.h index ea9a9ca..74868f5 100644 --- a/src/common.h +++ b/src/common.h @@ -28,7 +28,7 @@ using namespace std; -#define APP_VER "3.0.t11" +#define APP_VER "3.0.t12" #define APP_NAME "Motion Watch" #define APP_BIN "mow" #define REC_LOG_NAME "rec_log_lines.html"