-changed up the logic in EventLoop to better honer maxEventSecs
 and pick the highest scoring event as the event name and
 thumbnail.
This commit is contained in:
Zii 2023-06-10 09:45:26 -04:00
parent baf0b86610
commit 51218198b5
3 changed files with 48 additions and 35 deletions

View File

@ -267,35 +267,14 @@ bool Upkeep::exec()
EventLoop::EventLoop(shared_t *sharedRes, QThread *thr, QObject *parent) : Loop(sharedRes, thr, parent)
{
heartBeat = 2;
highScore = 0;
cycles = 0;
}
bool EventLoop::exec()
{
QStringList vidList;
QString imgPath;
QString name;
float highScore = 0;
while (!shared->recList.isEmpty())
if (cycles * 2 >= shared->evMaxSecs)
{
auto event = shared->recList[0];
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.removeLast();
vidList.append(forwardFacingFiles("live", ".ts", event.timeStamp, maxFiles / 2));
shared->recList.removeFirst();
}
vidList.removeDuplicates();
if (!vidList.size() > 1)
@ -318,6 +297,36 @@ bool EventLoop::exec()
}
}
cycles = 0;
highScore = 0;
vidList.clear();
}
else
{
cycles += 1;
while (!shared->recList.isEmpty())
{
auto event = shared->recList[0];
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.removeLast();
vidList.append(forwardFacingFiles("live", ".ts", event.timeStamp, maxFiles / 2));
shared->recList.removeFirst();
}
}
return Loop::exec();
}
@ -485,8 +494,6 @@ bool DetectLoop::exec()
event.score = score;
event.imgPath = images[pos];
delayCycles = (shared->evMaxSecs / 2) - 1;
shared->recList.append(event); mod = true;
}
}

View File

@ -101,6 +101,12 @@ class EventLoop : public Loop
private:
QStringList vidList;
QString imgPath;
QString name;
float highScore;
uint cycles;
bool wrOutVod(const QString &name, const QStringList &vids);
public:

View File

@ -28,7 +28,7 @@
using namespace std;
#define APP_VER "3.0.t14"
#define APP_VER "3.0.t15"
#define APP_NAME "Motion Watch"
#define APP_BIN "mow"
#define REC_LOG_NAME "rec_log_lines.html"