Commit Graph

409 Commits

Author SHA1 Message Date
Isaac Connor
9a996cb423 image may have been deleted, but analysis image may still be there. Correct logic so that analysis frame get saved again. 2023-02-19 14:47:43 -05:00
Isaac Connor
a0b23388b8 Handle failure to insert into Events table. 2023-02-02 10:03:18 -05:00
Isaac Connor
08f02ecd09 Queue packets instead of packet locks in event thread. Since we are using std::shared_ptr and not modifying the packet, should not need locking. Also, locking in one thread and unlocking in another is apparentlyundefined behaviour and doesn't work infreebsd. 2023-01-24 10:28:38 -05:00
Isaac Connor
388f1c6e1b Add const to MonitorId 2023-01-18 16:01:32 -05:00
Isaac Connor
79026b77a1 Use monitor::Substitute on Event Prefix 2022-09-28 15:53:43 -04:00
Isaac Connor
2bb0db96d8 When adjusting start_time, set end_time as well. 2022-08-26 09:33:42 -04:00
Isaac Connor
341021de74 Use a flag to tell whether we have written the snapshot jpeg yet. If image data has been freed from packets, we may not write the snapshot because we already had a packet with a higher score. 2022-08-22 14:56:55 -04:00
Isaac Connor
1bbb2ea3d5 reuse event_file to shut up cppcheck 2022-07-14 09:59:38 -04:00
Isaac Connor
009c1ab0fb We cannot break if there are packets in the queue. They must be deleted. 2022-06-23 16:57:08 -04:00
Isaac Connor
ca8ba73ee9 Revert "When we wake from wait, we MUST clear the queue. If a packet snuck in, it MUSt be deleted. Otherwise it remains locked. THis could likely be improved with RAII skills."
This reverts commit 80338467e7.
2022-06-23 16:55:34 -04:00
Isaac Connor
00b284314f Revert "Redo the login in Event::Run. We cannot leave with packets still in the queue. I think."
This reverts commit b6c5b47d66.
2022-06-23 16:54:57 -04:00
Isaac Connor
b6c5b47d66 Redo the login in Event::Run. We cannot leave with packets still in the queue. I think. 2022-06-23 14:31:08 -04:00
Isaac Connor
80338467e7 When we wake from wait, we MUST clear the queue. If a packet snuck in, it MUSt be deleted. Otherwise it remains locked. THis could likely be improved with RAII skills. 2022-06-22 21:00:06 -04:00
Isaac Connor
210a9d035b Fix a case where packets could be left in queue on delete 2022-04-30 14:04:09 -04:00
Isaac Connor
06dec70e57 Fix lockup due to not checking for terminate_ before grabbing the lock again 2022-04-30 14:04:09 -04:00
Isaac Connor
f72c85b110 Redo the body of event::Run() so that we don't hold the lock while actually processing the packets. Only around queue manipulation. Should free up analysis thread. 2022-04-28 16:42:54 -04:00
Isaac Connor
6f2b5f785d Code comment reminding us that packets in the event queue are locked. 2022-04-28 10:36:06 -04:00
Isaac Connor
7dcb45b7b7 Remove debugging, code style, spacing. Free lock before notifying 2022-04-03 16:21:40 -04:00
Isaac Connor
f17ca48cab Default end_time to start_time on event creation so that we don't get a negative duration 2022-03-26 12:47:46 -04:00
Isaac Connor
a40b305065 Merge branch 'master' into replace_function_concept 2022-02-20 09:52:03 -05:00
Isaac Connor
fe69261f10 Include MonitorId as second argument of EventStartCommand and EventEndCOmmand at @baudneo's request. 2022-02-19 15:33:05 -05:00
Isaac Connor
552974c5b7 Pass full packet to AddFrame so that we can also write other contents out 2022-02-12 22:14:21 -05:00
Isaac Connor
e5792c21c9 Push locked packets into event packetqueue instead of unlcoked contents. Prevents freeing of data before writing to event, hence crashing. 2022-01-28 15:38:18 -05:00
Isaac Connor
42e24614d6 Include filename in debugs when writing out jpegs 2022-01-26 11:45:07 -05:00
Isaac Connor
f764cfbc32 Fix deadlock on deleting event. Cannot race for the lock, joining will do the job 2022-01-12 23:11:19 -05:00
Isaac Connor
a9f7b257ea Rough in a queue and a thread into the event to process packets. We do this so that the event creator can get back to analysis as fast as possible so as to avoid the packetqueue filling up. 2022-01-12 17:16:49 -05:00
Isaac Connor
7215756fed Introduce a method update the noteSetMap after event creation (addNote). 2022-01-03 19:03:04 -05:00
Isaac Connor
e2a81cc2c5 make max_score an int to get rid of the casts. Move assignment of it above the event UPDATE sql so that it is immediately accurate. 2022-01-02 19:25:52 -05:00
Isaac Connor
c927ef4b52 Aim to do db updates every 5 seconds instead of 1 second 2021-11-29 18:34:19 -05:00
Isaac Connor
036d47a832 proper fix to memleak 2021-11-11 14:42:08 -05:00
Isaac Connor
6cd1f6b5f3 Fix memleak on event creation due to not freeing storage object 2021-11-11 13:50:18 -05:00
Isaac Connor
38105c6796 Spacing 2021-11-09 13:59:14 -05:00
Isaac Connor
814eca2b4f Include the codec in the resulting mp4 filename. Remove event update setting the mp4 filename after insert, do it on event completing instead. Saves 1 db update. 2021-11-03 17:02:02 -04:00
Isaac Connor
8619971864 Better debug messages 2021-11-02 17:24:05 -04:00
Isaac Connor
c78e035057 Fix crash due to int64 cast to a %ld format. 2021-09-23 19:07:07 -04:00
Isaac Connor
b0cf3a4732 Merge pull request #3314 from Carbenium/path-max
Fix Wformat for stringtf and convert path buffers depending on PATH_MAX to std::string
2021-07-07 11:34:03 -04:00
Peter Keresztes Schmidt
eaf2e51b0c utils: Make sure the compiler can emit format warnings for stringtf
Unfortunately the compilers can't emit Wformat warnings for variadic templates
and those can't be annotated with the format attribute.
Use a variadic function which can be annotated and thus warns on format string-args mismatches.

Ref 0796a2262e
2021-07-06 10:33:17 +02:00
Peter Keresztes Schmidt
65656de6ce db: Adjust the query methods to accept std::strings 2021-07-06 10:20:46 +02:00
Peter Keresztes Schmidt
fc15afefcf Event: Remove unused and broken prepared statement code 2021-07-06 10:20:45 +02:00
Peter Keresztes Schmidt
cf9c47149f db: Add helper for escaping strings and use it 2021-07-06 10:20:45 +02:00
Peter Keresztes Schmidt
707975e567 Monitor: Convert API to std::chrono 2021-06-13 23:22:49 +02:00
Peter Keresztes Schmidt
dff5452f11 Event: Convert API to std::chrono 2021-06-13 23:20:24 +02:00
Peter Keresztes Schmidt
335e950654 Frame: Convert API to std::chrono 2021-06-13 23:20:24 +02:00
Peter Keresztes Schmidt
ff8c9f67c1 Image: Convert API to std::chrono
Utils: Remove TimespecDiff. It is not used anymore
2021-06-13 14:50:16 +02:00
Peter Keresztes Schmidt
e1fe53338c BaseStream: Convert internals to std::chrono 2021-06-13 11:29:59 +02:00
Peter Keresztes Schmidt
44ace34593 Event: Convert internals to std::chrono 2021-06-08 19:41:11 +02:00
Peter Keresztes Schmidt
d8d27bcc92 Time: Replace remaining DeltaTimeval usage with std::chrono 2021-06-07 23:53:53 +02:00
Peter Keresztes Schmidt
6c68397249 Time: Convert some timeval operations to std::chrono
Also remove now defunct timeval helper methods.
2021-06-07 23:53:53 +02:00
Peter Keresztes Schmidt
7474294ac3 Time: Remove DELTA_TIMEVAL macro and replace usage with proper std::chrono::duration operations 2021-06-06 16:41:36 +02:00
Isaac Connor
72d07d1428 Add a bunch of debugging about snapshot writing 2021-06-04 15:00:16 -04:00