v3.1.t1
-added event age to evt_t as a way to track the age of the event in EventLoop so now only events approching and exceeding evMaxSecs will have the video range added for writing.
This commit is contained in:
parent
ff5f95f445
commit
5f9c4be6b2
|
@ -253,7 +253,7 @@ EventLoop::EventLoop(shared_t *sharedRes, QThread *thr, QObject *parent) : Loop(
|
|||
|
||||
bool EventLoop::exec()
|
||||
{
|
||||
if (cycles * 2 >= shared->evMaxSecs)
|
||||
if (!vidList.isEmpty())
|
||||
{
|
||||
vidList.removeDuplicates();
|
||||
|
||||
|
@ -282,32 +282,46 @@ bool EventLoop::exec()
|
|||
|
||||
vidList.clear();
|
||||
}
|
||||
else
|
||||
|
||||
shared->recMutex.lock();
|
||||
|
||||
QList<int> rmIndx;
|
||||
|
||||
for (auto i = 0; i < shared->recList.size(); ++i)
|
||||
{
|
||||
cycles += 1;
|
||||
auto event = &shared->recList[i];
|
||||
|
||||
shared->recMutex.lock();
|
||||
|
||||
for (auto &&event : shared->recList)
|
||||
if (highScore < event->score)
|
||||
{
|
||||
auto maxFiles = shared->evMaxSecs / 2;
|
||||
// there's 2 secs in each hls segment
|
||||
|
||||
if (highScore < event.score)
|
||||
{
|
||||
name = event.timeStamp.toString(DATETIME_FMT);
|
||||
imgPath = event.imgPath;
|
||||
highScore = event.score;
|
||||
}
|
||||
|
||||
vidList.append(backwardFacingFiles("live", ".ts", event.timeStamp, maxFiles / 2));
|
||||
vidList.append(forwardFacingFiles("live", ".ts", event.timeStamp, maxFiles / 2));
|
||||
name = event->timeStamp.toString(DATETIME_FMT);
|
||||
imgPath = event->imgPath;
|
||||
highScore = event->score;
|
||||
}
|
||||
|
||||
shared->recList.clear();
|
||||
shared->recMutex.unlock();
|
||||
if (event->queAge >= (shared->evMaxSecs / heartBeat))
|
||||
{
|
||||
auto maxSecs = shared->evMaxSecs / 2;
|
||||
// half the maxsecs value to get front-back half secs
|
||||
|
||||
auto backFiles = backwardFacingFiles("live", ".ts", event->timeStamp, maxSecs);
|
||||
auto frontFiles = forwardFacingFiles("live", ".ts", event->timeStamp, maxSecs);
|
||||
|
||||
vidList.append(backFiles + frontFiles);
|
||||
rmIndx.append(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
event->queAge += heartBeat;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto i : rmIndx)
|
||||
{
|
||||
shared->recList.remove(i);
|
||||
}
|
||||
|
||||
shared->recMutex.unlock();
|
||||
|
||||
return Loop::exec();
|
||||
}
|
||||
|
||||
|
@ -377,9 +391,9 @@ DetectLoop::DetectLoop(shared_t *sharedRes, QThread *thr, QObject *parent) : Loo
|
|||
{
|
||||
pcTimer = 0;
|
||||
heartBeat = 2;
|
||||
delayCycles = 8; // this will be used to delay the
|
||||
// actual start of DetectLoop by
|
||||
// 16secs.
|
||||
delayCycles = 12; // this will be used to delay the
|
||||
// actual start of DetectLoop by
|
||||
// 24secs.
|
||||
}
|
||||
|
||||
void DetectLoop::init()
|
||||
|
@ -473,6 +487,7 @@ bool DetectLoop::exec()
|
|||
event.timeStamp = curDT;
|
||||
event.score = score;
|
||||
event.imgPath = images[pos];
|
||||
event.queAge = 0;
|
||||
|
||||
shared->recMutex.lock();
|
||||
shared->recList.append(event); mod = true;
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
#define APP_VER "3.0.0"
|
||||
#define APP_VER "3.1.t1"
|
||||
#define APP_NAME "Motion Watch"
|
||||
#define APP_BIN "mow"
|
||||
#define REC_LOG_NAME "rec_log_lines.html"
|
||||
|
@ -45,6 +45,7 @@ struct evt_t
|
|||
QDateTime timeStamp;
|
||||
QString imgPath;
|
||||
float score;
|
||||
uint queAge;
|
||||
};
|
||||
|
||||
struct shared_t
|
||||
|
|
Loading…
Reference in New Issue
Block a user