Peter Keresztes Schmidt
783dc09b4e
Box: Rename variables according to the styleguide
2021-05-16 16:42:58 +02:00
Peter Keresztes Schmidt
8f685b3d66
Box+Poly: Remove direct accessors to {Hi,Lo}{X,Y}
2021-05-16 16:42:58 +02:00
Peter Keresztes Schmidt
f85e3765db
Box: Remove unnecessary constructors
2021-05-16 16:42:58 +02:00
Peter Keresztes Schmidt
e6c159fb70
Vector2: Make coordinate components public
...
The components were already unconditionally/without side-effects writable. Let's make them public so we don't need the setters.
2021-05-16 16:42:58 +02:00
Peter Keresztes Schmidt
c8885fe2aa
Vector2: Use default copy/assignment ops
2021-05-14 20:14:50 +02:00
Peter Keresztes Schmidt
290b88e5ac
Vector2: Delete non-idiomatic comparison operators
...
The "greater than" and "lesser than" operator families don't make sense for coordinates.
If lexicographic comparison for ordering purposes is needed, it should be implemented separately.
2021-05-14 20:14:50 +02:00
Peter Keresztes Schmidt
60db1c2eaf
Coord: Rename to Vector2
...
The class is not only used to represent coordinates but also lengths in XY.
Vector2 is a more fitting/general name for this purpose.
2021-05-14 20:14:50 +02:00
Peter Keresztes Schmidt
3fc3a81286
Box+Coord: Remove empty cpp files
2021-05-14 20:14:50 +02:00
Isaac Connor
a56b4053fa
Use resize in stead of reserve so that image_buffer.size actually has a value
2021-05-13 14:24:03 -04:00
Isaac Connor
d52b53e690
Add further bounds checks when accessing image_buffer
2021-05-13 09:31:59 -04:00
Isaac Connor
70946921bc
fix code to release lock before notifying
2021-05-13 08:54:55 -04:00
Isaac Connor
5a8fa9efc9
Remove dead code and useless debug
2021-05-12 18:54:07 -04:00
Isaac Connor
6f977da94d
Fix potential outofbounds access to image_buffer in getSnapshot()
2021-05-12 14:21:54 -04:00
Isaac Connor
76171fcc43
If not doing passthrough, don't need to find the nearest keyframe
2021-05-11 10:22:40 -04:00
Isaac Connor
510b3e606b
Continue if frame file not found. Output useful text jpeg
2021-05-11 09:33:33 -04:00
Isaac Connor
b8e3cc33f0
make it so that the queue will more likely be empty on termination. Do not queue more sql if terminate flag is set.
2021-05-10 12:54:35 -04:00
Isaac Connor
3cd9bdccd5
style and performance improvements reported by cppcheck
2021-05-09 16:39:38 -04:00
Isaac Connor
01834d4ddc
finish converting Capture to std::shared_ptr
2021-05-09 07:35:47 -04:00
Isaac Connor
e970c46f7b
fix memleak. Fixes #3217
2021-05-09 07:18:36 -04:00
Isaac Connor
2cf6ad8089
Switch ZMPacket * to a shared_ptr<ZMPacket>. This is so that in LockedPacket we can unlock and then notify and be confident that packet_ won't have been deleted. Change ZMPacket->timestamp to be a timeval instead of timeval *. This might not have been necessary but I like it. No longer cuse the ZMPacket object to wrap the shared image buffers and timestamps. Use a vector for image_buffers.
2021-05-08 21:14:20 -04:00
Isaac Connor
9ee24170a9
use packetqueue.unlock instead of deleting the lock so that we wake up people waiting
2021-05-08 15:57:00 -04:00
Isaac Connor
d3e91da514
sigh. Move the snap unlock further down protecting another use of snap. Use a video test instead of image count to determine videoness of the snap
2021-05-08 12:35:28 -04:00
Isaac Connor
bd6566a819
Have to clearpacket while holding the lock on snap. Otherwise it can get deleted the moment we unlock it.
2021-05-08 12:26:13 -04:00
Isaac Connor
7efbf78260
Merge branch 'master' of github.com:ZoneMinder/zoneminder
2021-05-07 14:23:39 -04:00
Isaac Connor
a91197b47c
reset score_ to zero when we return for failing to meet pixel filters
2021-05-07 14:23:36 -04:00
Isaac Connor
4685c63fab
Add early return if pktQueue is empty so we can assume that it isn't below. Add notifications if we wake up and find that we have terminated so as to wake up any other waiters. Fixes failure to terminate when deinterlacing because both decoder and analysis are waiting
2021-05-07 14:04:51 -04:00
Isaac Connor
9c6d3989d3
Fix cases of failing to get second packet in de-interlacing
2021-05-07 14:03:36 -04:00
Isaac Connor
5ca5ce32e9
More debugging code, use nullptr instead of null
2021-05-07 09:11:00 -04:00
Isaac Connor
43f2f195f1
Fix a case in get_event_start_packet_it where if no pre_event_count we log an error and maybe don't start on a keyframe
2021-05-07 09:10:26 -04:00
Isaac Connor
4ea48708ed
move the code that waits for decoder to outside the motion detection area. In record mode decoding can happen behind analysis which seems like a good idea, except that then analysis won't free up the raw image.
2021-05-07 09:09:40 -04:00
Isaac Connor
442f126193
Fix compile on xenial which doesn't have hwaccel
2021-05-06 11:04:38 -04:00
Isaac Connor
b0b6de948d
Add h265 encoding with libx265, hevc_vaapi and hevc_nvenc
2021-05-05 16:47:39 -04:00
Isaac Connor
31a95fa27c
add nvenc support
2021-05-05 13:58:31 -04:00
Isaac Connor
3645ccea1b
Make vaapi accelerated encoding work
2021-05-04 20:20:33 -04:00
Isaac Connor
8f27db5d6f
Do not stop dbQueue in logTerm. dbQueue is not just for logging.
2021-05-04 14:22:02 -04:00
Isaac Connor
4f4a1a4565
if sendTextFrame fails, just exit.
2021-05-03 16:27:37 -04:00
Isaac Connor
934c726beb
Handle camera not being defined in SubpixelOrder and Colours. Remove subpixelorder as it exists in camera only
2021-05-03 15:19:45 -04:00
Isaac Connor
80d2f9f098
Revert "Don't consult a Camera object to return colours and subpixelorder, we have those as members. Fixes crash in zms"
...
This reverts commit 48f79da892
.
2021-05-03 14:19:34 -04:00
Isaac Connor
bc6ba0a772
Merge branch 'master' of github.com:ZoneMinder/zoneminder
2021-05-03 13:18:51 -04:00
Isaac Connor
8bd876d8c8
improve warning message to include the values that don't match
2021-05-03 13:18:39 -04:00
Isaac Connor
90dff85e40
Only default to BGRA when colours are > 1.
2021-05-03 13:17:58 -04:00
Isaac Connor
bf72bb2a22
Increase sleep after prime failure up to a minute.
2021-05-03 10:38:01 -04:00
Peter Keresztes Schmidt
e5ceed31cc
Image: Fix a typo introduced in 3f5dbb7780
2021-05-02 23:22:49 +02:00
Peter Keresztes Schmidt
e5613d0d27
Make sure all logging macro calls are terminated with a semicolon
2021-05-02 23:08:48 +02:00
Isaac Connor
260fcaadde
remove debug
2021-05-02 14:07:29 -04:00
Isaac Connor
3f5dbb7780
Default to rgba when subpixelorder is not specified
2021-05-02 14:07:29 -04:00
Isaac Connor
88147f3f7a
add another logInit so that early messages go to zms.log after loading config. Add Image::Initialise so that initialised flag will get set, and add a Deinitialise call so that ram allocated in zm_image gets freed.
2021-05-01 14:49:33 -04:00
Isaac Connor
59b1927ad6
do dbQUeue.stop in logTerm so we don't have to have an extra line in every executable
2021-05-01 14:49:33 -04:00
Isaac Connor
48f79da892
Don't consult a Camera object to return colours and subpixelorder, we have those as members. Fixes crash in zms
2021-05-01 14:49:33 -04:00
Isaac Connor
ad388e9fc5
Free up encodejpg_ccinfo in Deinitialize
2021-05-01 14:49:33 -04:00
Peter Keresztes Schmidt
14cb2bc3dd
zm_rtsp_server: Remove an unused variable
2021-05-01 00:24:54 +02:00
Peter Keresztes Schmidt
68bedfe48f
Fix logging format string mismatches
...
* Remove SZFMTD format macro and use %zu instead for size_t. %zu is understood by every compiler nowadays.
2021-04-30 00:26:24 +02:00
Peter Keresztes Schmidt
c3dd8d8a47
Logger: Annotate logPrint with format attribute
...
This allows the compiler to check for mismatches in the format string and the passed parameters.
2021-04-29 17:12:44 +02:00
Isaac Connor
0da4127114
cleanup ready_count update unneeded. Fix crash on reload due to being disconnected.
2021-04-29 07:07:12 -04:00
Isaac Connor
3d11366c0f
restart stream when RTSP stream name changes
2021-04-29 06:38:42 -04:00
Isaac Connor
1abadfafa1
Increase debug log level of allocating image
2021-04-28 16:13:57 -04:00
Isaac Connor
e53628e0bd
Remove old deinterlace code, make new code in ::decode. For 4 field, use the next image in the queue isntead of doing another capture
2021-04-28 16:13:41 -04:00
Isaac Connor
ba652af347
Define deinterlace values in an enum
2021-04-28 16:13:10 -04:00
Isaac Connor
a9ca6f8c13
Check for packets in the queue before we start traversing it to prevent crash
2021-04-28 12:12:24 -04:00
Isaac Connor
f61618b244
rework rtsp_server to look for new and free up old monitors
2021-04-27 16:35:13 -04:00
Peter Keresztes Schmidt
36205258c0
Image: Fix crash in Annotate in GRAY8 and RGB24 mode
...
Actually advance the image buffer pointer by one image line when looping through the codepoint lines.
2021-04-27 21:11:50 +02:00
Isaac Connor
2e35d94c94
Add missing source_
2021-04-27 10:34:22 -04:00
Isaac Connor
d9aac9bea9
it is ok to have empty monitors, should detect when new ones arrive
2021-04-27 10:28:46 -04:00
Isaac Connor
75973a2df1
Check for thread status before waiting. Fixes hang
2021-04-27 10:28:46 -04:00
Isaac Connor
9f49ac217e
add Stopped function to test whether the analysis thread is stopped from outside the class
2021-04-27 10:28:46 -04:00
Isaac Connor
df5b14dbd4
Merge pull request #3221 from Carbenium/zone-stats
...
Some optimizations/cleanups concerning Zones and ZoneStats
2021-04-27 09:26:07 -04:00
Isaac Connor
7bbcb7e36a
Merge pull request #3223 from Carbenium/font
...
Modernize the ZmFont API and add tests
2021-04-25 19:57:32 -04:00
Peter Keresztes Schmidt
3020acf994
ZmFont: Store character padding in font file
...
The size/variant specific character padding should be stored with the font data.
Modify the FontBitmapHeader accordingly and introduce a version field in the FontFileHeader
so we are able to check we have a font file with the right structure associated with that version.
The version field is set to 1 in this changeset.
2021-04-25 23:13:21 +02:00
Peter Keresztes Schmidt
a918e8aeba
Image: Modernize Annotate method
2021-04-25 23:13:21 +02:00
Peter Keresztes Schmidt
07e49e47af
utils: Add a clamping function mimicking std::clamp
...
This can be replaced with std::clamp in C++17.
2021-04-25 23:13:21 +02:00
Peter Keresztes Schmidt
0c939f45dd
ZmFont: Rework/modernize API
2021-04-25 23:13:21 +02:00
Peter Keresztes Schmidt
6d06eac55e
Monitor: Fix a crash when destroying a monitor (shutdown)
...
We have to make sure close_event_thread is joined before we destroy the thread object,
otherwise std::terminate will be called.
2021-04-25 23:09:32 +02:00
Peter Keresztes Schmidt
4180bc99ac
Zone: Sprinkle some const-ness
...
Keep references in for-loops const if no modifications are preformed on the object.
2021-04-25 22:34:33 +02:00
Peter Keresztes Schmidt
d4458d1216
Monitor: Store zones as vector instead of list
...
std::vector suits the usage pattern better with no random inserts/deletions
2021-04-25 22:29:18 +02:00
Peter Keresztes Schmidt
bb35d0a8bb
Frame: Auto-format
2021-04-25 22:29:18 +02:00
Peter Keresztes Schmidt
eb51408ef9
ZMPacket+Frame: Use vector to store ZoneStats
...
We don't any of the usage patterns that would warrant a std::list (random insert/deletion). Switch to vector which has much lower overhead for this kind of usage.
2021-04-25 22:29:18 +02:00
Peter Keresztes Schmidt
ad32a94931
ZoneStats: Rename members according to Google style guide
2021-04-25 17:18:07 +02:00
Peter Keresztes Schmidt
9e4674b53a
ZoneStats: Let the compiler define the copy constr. and assignment op.
...
There is no need for the user-defined versions since no manual resource management is done in the class.
Also a user-defined copy constructor or assignment operator prevents the implicit definition of a move constructor.
2021-04-25 17:18:07 +02:00
Isaac Connor
95a715a96a
When resume is given, clear the ref image, so that analysis can re-assign it. Don't do ref image in decode, leave it for analysis only. Handle zm_terminate after waiting for decode.
2021-04-23 14:52:29 -04:00
Isaac Connor
affac43964
Move DumpImgBuffer into public section so that we can clear an image instead of deleting it
2021-04-23 14:52:29 -04:00
Isaac Connor
76080cb857
add a stop function to dbQueue to clear out the queue before we kill log.
2021-04-23 09:25:07 -04:00
Isaac Connor
3e88f60f6d
Fix end code block comment on DetectMotion
2021-04-23 09:19:13 -04:00
Isaac Connor
b9fb08745c
Cleanup, fix length test for stats insert
2021-04-23 09:18:56 -04:00
Isaac Connor
9e890a7539
Add libcurl.so.4 as an option to load before libcurl-gnutls
2021-04-23 09:10:54 -04:00
Isaac Connor
27d200d376
Switch to using std::string for inserting frames and stats. We just can't know how long the sql will be and we aren't going to waste 2MB of ram on it. Remove unused functions.
2021-04-22 22:30:45 -04:00
Isaac Connor
8671e65517
More work on flushing out ZoneStats. Use references to avoid copying
2021-04-21 21:40:39 -04:00
Isaac Connor
be9c5d3f95
Introduce a ZoneStats structure/class and implement a list of them in packet, frame. Store the stats in a list in the packet until it is time to write them to the db in the event. Hence implement batched queuing of stats.
2021-04-21 17:51:43 -04:00
Isaac Connor
8ca93d2f0b
store event stats regardless of savejpegs or image availability
2021-04-21 14:59:57 -04:00
Isaac Connor
408e0963a0
Improve code and logging
2021-04-20 23:06:17 -04:00
Isaac Connor
b2f96728d5
Spacing and improve debugging
2021-04-20 23:06:04 -04:00
Isaac Connor
c48b42c2df
alarm frames without an image are still alarm frames. Count them in alarm count
2021-04-20 23:05:52 -04:00
Isaac Connor
fd72fbd2ac
Remove unused state var and unneeded if have_output
2021-04-20 17:22:35 -04:00
Isaac Connor
c7f06dda0b
Improve copy constructor to use initializers
2021-04-20 17:18:57 -04:00
Isaac Connor
a3379c986b
Only have fifo if HAVE_LIBSWRESAMPLE
2021-04-20 17:18:45 -04:00
Isaac Connor
1657d30be6
add override
2021-04-20 17:18:23 -04:00
Isaac Connor
9ea10584b7
pass fifo by const ref
2021-04-20 17:18:09 -04:00
Isaac Connor
9a54956163
pass fifo by const ref
2021-04-20 17:18:00 -04:00
Isaac Connor
c83b9190cb
pass peer_ip by const ref
2021-04-20 17:16:09 -04:00
Isaac Connor
05e7b6dfc5
add explicit
2021-04-20 17:15:53 -04:00
Isaac Connor
1f48dbbf6c
Use %u instead of %d for monitor id
2021-04-20 17:15:39 -04:00
Isaac Connor
6dc05ec942
add overrides
2021-04-20 17:09:51 -04:00
Isaac Connor
f23baf22de
Remove unused edges and slices
2021-04-20 17:09:42 -04:00
Isaac Connor
b6af846664
add missing initializers
2021-04-20 17:09:14 -04:00
Isaac Connor
beb2c4ddf7
fix redundant if
2021-04-20 17:09:00 -04:00
Isaac Connor
b37aa35085
improve scope of a,b
2021-04-20 17:07:07 -04:00
Isaac Connor
ccf1599b3a
use better variable names and avoid reusing user
2021-04-20 17:06:29 -04:00
Isaac Connor
de661752ce
pass jwt_token_str by reference
2021-04-20 17:04:45 -04:00
Isaac Connor
1f7da2835f
Fix overlaping use of i variable. Remove unused payloadDesc
2021-04-20 17:01:54 -04:00
Isaac Connor
21b6ac5a43
Make params const
2021-04-20 16:41:08 -04:00
Isaac Connor
da3a302ddd
improve scope of buffer_len
2021-04-20 16:38:42 -04:00
Isaac Connor
d86fc9fdd6
fix = operator to not require self-check
2021-04-20 16:35:47 -04:00
Isaac Connor
77055ee1cc
Remove unused code
2021-04-20 16:18:50 -04:00
Isaac Connor
7a674be285
Quiet cppcheck
2021-04-20 14:25:17 -04:00
Isaac Connor
32ae30a7b2
Fix alarm cause
2021-04-20 14:19:29 -04:00
Isaac Connor
433c3388fe
Pass where string by ref
2021-04-20 14:13:09 -04:00
Isaac Connor
6b1b873e9f
Reduce scope of vars, fix return value test of shmat
2021-04-20 14:10:58 -04:00
Isaac Connor
aad3b243c7
initialize padding
2021-04-20 14:10:33 -04:00
Isaac Connor
b0b95b57f8
packet can be const
2021-04-20 13:59:54 -04:00
Isaac Connor
320dfff5b2
Remove unused non blocking case
2021-04-20 13:59:07 -04:00
Isaac Connor
b62e8f7a81
mFormatContextPtr doesn't need to be a class member
2021-04-20 13:58:23 -04:00
Isaac Connor
45247c4d59
Add override to Close
2021-04-20 13:55:58 -04:00
Isaac Connor
ad830e43c6
clean up CheckSignal, getting rid of static vars
2021-04-20 13:26:47 -04:00
Isaac Connor
7561e88d9c
Change %d to %u for monitor id
2021-04-20 13:12:00 -04:00
Isaac Connor
c0c5c07ecf
Quiet cppcheck issues
2021-04-20 12:59:59 -04:00
Isaac Connor
813730f8b5
remove dead code
2021-04-20 12:59:41 -04:00
Isaac Connor
9249c736d5
Add overrides
2021-04-20 12:59:27 -04:00
Isaac Connor
bb0741dc6f
Add missing initializers
2021-04-20 12:59:19 -04:00
Isaac Connor
1beeea351b
Add overrides
2021-04-20 12:59:08 -04:00
Isaac Connor
4f71538334
Remove the unused non_blocking code
2021-04-20 12:58:55 -04:00
Isaac Connor
6ea4d4162f
Add overrides
2021-04-20 12:58:35 -04:00
Isaac Connor
fa3ce0d247
Add overrides
2021-04-20 12:58:17 -04:00
Isaac Connor
2d6d39acee
init mVncData
2021-04-20 11:48:21 -04:00
Isaac Connor
2469df3b67
add overrides to quiet cppcheck
2021-04-20 11:48:12 -04:00
Isaac Connor
44d4a79f70
Fixes by cppcheck
2021-04-20 11:39:37 -04:00
Isaac Connor
467baf8a95
fix bogus font validation
2021-04-20 11:37:57 -04:00
Isaac Connor
9970df7fde
Pass delta by ref for performance
2021-04-20 11:36:20 -04:00
Isaac Connor
c668eb7134
Add overrides to quiet cppcheck
2021-04-20 11:08:15 -04:00
Isaac Connor
2679b3a51a
fix use of %d when %u is wanted
2021-04-20 11:07:22 -04:00
Isaac Connor
19cb66b70d
fix use of %d when %u is wanted
2021-04-20 11:06:54 -04:00
Isaac Connor
e8b761d2bf
cppcheck cleanups
2021-04-20 11:04:27 -04:00
Isaac Connor
c833833a5e
quiet cppcheck by adding overrides
2021-04-20 11:01:02 -04:00
Isaac Connor
e5d4665a42
Quiet cpp-check complaints
2021-04-20 11:00:13 -04:00
Isaac Connor
b6fcadf31b
Put dbrow and fetch into a scope so that it goes away quick
2021-04-20 10:55:39 -04:00
Isaac Connor
0343642c42
duplicate test for neagtive timestamp
2021-04-20 10:54:24 -04:00
Isaac Connor
88a5afc1d2
Fix cpp-check reporting unused variable
2021-04-20 10:45:33 -04:00
Isaac Connor
51c4211ca6
Remove unused variable
2021-04-20 10:43:27 -04:00
Isaac Connor
ece981c018
Fix bool return value when int is desired
2021-04-20 10:41:41 -04:00
Isaac Connor
ff2017d8b0
Initialize video_sources and audio_sources to prevent crash
2021-04-20 09:22:37 -04:00
Isaac Connor
e0fc265263
spacing
2021-04-19 13:19:23 -04:00
Isaac Connor
f5e249a6f2
ifout an unused constructor in zone. Add polygon copy in copy constructor.
2021-04-19 13:19:17 -04:00
Isaac Connor
f3fb5885a0
Improve debugging
2021-04-19 13:18:35 -04:00
Isaac Connor
3fc9f5ac32
Prevent multiple threads being created by zmc restart by converting sources into a vector
2021-04-19 12:38:35 -04:00
Isaac Connor
c1035b7ffd
spacing, remove dead code
2021-04-19 10:26:08 -04:00
Isaac Connor
63d7c9a577
Don't tidy in extract as we assume the space will be used soon.
2021-04-19 10:26:08 -04:00
Isaac Connor
a9afdbddf1
Remove AddZones function and remove other commented out code
2021-04-19 10:26:08 -04:00
Isaac Connor
a38463f99e
spacing
2021-04-19 10:26:08 -04:00
Isaac Connor
8d883ee7bf
This breaks
2021-04-18 13:58:26 -04:00
Isaac Connor
07b3a7aa57
fix memleak caused by not deleting the packetlock when we can't get the lock
2021-04-17 12:50:26 -04:00
Isaac Connor
5b9745b652
fix memleak due to not delete audio_fifo and video_fifo
2021-04-17 12:50:26 -04:00
Isaac Connor
03767236d9
Clean up constructor/Setup functions. Add copy constructor. Change Load to return a std::list<Zone>
2021-04-17 12:50:26 -04:00
Isaac Connor
5ab9a48599
Don't grab lock in increment_it if we are deleting cuz we will hang
2021-04-17 12:50:26 -04:00
Isaac Connor
96deedfd53
add explicit to LockedPacket constructor
2021-04-17 12:50:26 -04:00
Isaac Connor
5ace2ca082
Fix loading Importance in sql. Change zones to a std::list<Zone>
2021-04-17 12:50:26 -04:00
Isaac Connor
7970bfd3d8
Implement a 10 second timeout in ffmpeg_camera. read_frame can block forever otherwise
2021-04-17 12:50:26 -04:00
Isaac Connor
df36623792
Put a \0 at the beginning of the buffer to help when printing out the contents
2021-04-17 12:50:26 -04:00
Isaac Connor
a0d08b8277
More debug in read_into
2021-04-17 12:50:26 -04:00
Isaac Connor
1d034b16dd
Must join the previous thread before starting a new one or we crash
2021-04-17 12:50:26 -04:00
Isaac Connor
c479c6d68f
Must disconnect on error/reload to avoid memleak. Remove waiting 5 second on failure/reload.
2021-04-17 12:50:26 -04:00
Isaac Connor
968bdc5abe
Correct nal count reporting
2021-04-17 12:50:26 -04:00
Isaac Connor
9b4fcf4e92
Only complain about finding an iterator if we havn't found a new keyframe
2021-04-14 13:00:16 -04:00
Isaac Connor
cfefe3fc1a
Merge pull request #3214 from Carbenium/type-limits
...
Fix warnings reported by Wtype-limits and re-enable the warning on GCC
2021-04-13 10:27:56 -04:00
Isaac Connor
ef10ecc06a
Allow users to start/stop alarms without monitor view permission. When forcing an alarm, disable recording first so that the alarm is distinct. This is necessary due to permissions.
2021-04-12 15:59:31 -04:00
Isaac Connor
e373e871da
Fix memleak caused by loadMonitor that is already loaded
2021-04-12 15:59:31 -04:00
Isaac Connor
cfe51d7349
Disconnect if we call loadMonitor a second time.
2021-04-12 15:59:31 -04:00
Isaac Connor
7adeb87041
fix logic that would leak mem by called loadMonitor repeatedly
2021-04-12 15:59:31 -04:00
Isaac Connor
1a81723ba5
add an isConnected function
2021-04-12 15:59:31 -04:00
Isaac Connor
ab356a3695
Add a warning when connecting without disconnecting which can cause memleaks
2021-04-12 15:59:31 -04:00
Peter Keresztes Schmidt
4894c319cc
Image: Fix Wtype-limits warnings in zm_convert_yuyv_rgb
...
The intermediate values can be negative. Change the variables to be signed so the clamping later on works correctly.
2021-04-12 08:58:57 +02:00
Peter Keresztes Schmidt
11cfa86de3
Image: Fix Wtype-limits warnings in Annotate
...
line[c] is a char. There is no possibility for it to be larger than 0xff. Remove these checks.
2021-04-12 08:58:56 +02:00
Peter Keresztes Schmidt
7e1c580130
define: Add macro to annotate intended switch fallthroughs
...
Follow-up to 814953b331
It turns out [[gcc::fallthrough]] and -Wimplicit-fallthrough were only implemented in GCC 7 and throws a warning on older GCCs.
Add the FALLTHROUGH macro to handle GCC < 7 as found on Xenial.
Warning from GCC 5.5:
/home/runner/work/zoneminder/zoneminder/src/zm_remote_camera_http.cpp:624:13: warning: attributes at the beginning of statement are ignored [-Wattributes]
[[gnu::fallthrough]];
2021-04-11 23:39:35 +02:00
Isaac Connor
f077ec6145
Take first PTS into account when calculating last pts for figuring out which input to use.
2021-04-11 16:35:16 -04:00
Isaac Connor
dab89622af
Not having a video stream isn't actually bad. Change log to debug
2021-04-11 13:29:24 -04:00
Isaac Connor
594cebbcb1
Increase debugging level of input choice
2021-04-11 13:23:21 -04:00
Isaac Connor
939a0f40e6
Include image_count in debug line
2021-04-11 13:22:37 -04:00
Isaac Connor
4255f78602
Use monitor->Importance in passing severity of log message about failed to Prime Capture
2021-04-11 12:59:18 -04:00
Isaac Connor
ed29021179
Rough in an importance setting in monitor that we can use to decrease the log level of certain events like PrimeCapture for cameras that we don't care about
2021-04-11 12:59:18 -04:00
Isaac Connor
aadfa1e6e1
Remove warning on fail to Prime. zmc will log it
2021-04-11 12:59:18 -04:00
Isaac Connor
d05f03eacd
Merge branch 'master' of github.com:ZoneMinder/ZoneMinder
2021-04-11 12:45:07 -04:00
Isaac Connor
526b44b377
fix crash by using the correct FormatContext when dumping stream info
2021-04-11 12:44:59 -04:00
Peter Keresztes Schmidt
627f972fac
LocalCamera: Fix Wformat warnings reported by Clang
2021-04-11 18:00:12 +02:00
Isaac Connor
f50bfab0aa
Merge pull request #3212 from Carbenium/sdp-deprec
...
SessionDescriptor: Fix a ffmpeg deprecation warning
2021-04-11 11:53:18 -04:00
Peter Keresztes Schmidt
9f643ddd00
MonitorStream: Actually use the MAX_SLEEP_USEC variable meant for this class
2021-04-11 14:39:08 +02:00
Peter Keresztes Schmidt
2d062c1f99
Fifo+EventStream: Remove unused private fields
2021-04-11 14:26:37 +02:00
Peter Keresztes Schmidt
c255e78b97
SessionDescriptor: Fix a ffmpeg deprecation warning
...
AVStream::codec is deprecated. The replacement AVStream::codecpar is initialized at the end of the method from the codec context.
2021-04-11 11:41:53 +02:00
Peter Keresztes Schmidt
0203e744a5
RtspThread: Fix a stack-buffer-overflow reported by ASAN
...
==8109==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fab9b156480 at pc 0x7fabaebef57b bp 0x7fab9b154640 sp 0x7fab9b153df0
READ of size 32 at 0x7fab9b156480 thread T2
#0 0x7fabaebef57a (/lib/x86_64-linux-gnu/libasan.so.5+0xb857a)
#1 0x561c0a9e24eb in bool std::__equal<true>::equal<char>(char const*, char const*, char const*) /usr/include/c++/8/bits/stl_algobase.h:814
#2 0x561c0a9dfa8e in bool std::__equal_aux<char*, char*>(char*, char*, char*) /usr/include/c++/8/bits/stl_algobase.h:831
#3 0x561c0a9dd982 in bool std::equal<__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >
, __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >(__gnu_cxx::__normal_iterator<char*,
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::c
har_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>
> >) /usr/include/c++/8/bits/stl_algobase.h:1049
#4 0x561c0a9cf75a in RtspThread::Run() /root/zoneminder/src/zm_rtsp.cpp:411
#5 0x561c0a9df6e9 in void std::__invoke_impl<void, void (RtspThread::*)(), RtspThread*>(std::__invoke_memfun_deref, void (RtspThread::*&&)(), RtspThread*&
&) /usr/include/c++/8/bits/invoke.h:73
#6 0x561c0a9dd4ae in std::__invoke_result<void (RtspThread::*)(), RtspThread*>::type std::__invoke<void (RtspThread::*)(), RtspThread*>(void (RtspThread::
*&&)(), RtspThread*&&) (/root/zoneminder/cmake-build-debug-remote/src/zmc+0x1544ae)
#7 0x561c0a9e6a1a in decltype (__invoke((_S_declval<0ul>)(), (_S_declval<1ul>)())) std:🧵 :_Invoker<std::tuple<void (RtspThread::*)(), RtspThread*> >
::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/include/c++/8/thread:244
#8 0x561c0a9e698d in std:🧵 :_Invoker<std::tuple<void (RtspThread::*)(), RtspThread*> >::operator()() /usr/include/c++/8/thread:253
#9 0x561c0a9e68ff in std:🧵 :_State_impl<std:🧵 :_Invoker<std::tuple<void (RtspThread::*)(), RtspThread*> > >::_M_run() /usr/include/c++/8/threa
d:196
#10 0x7fabaca57b2e (/lib/x86_64-linux-gnu/libstdc++.so.6+0xbbb2e)
#11 0x7fabae50dfa2 in start_thread /build/glibc-vjB4T1/glibc-2.28/nptl/pthread_create.c:486
#12 0x7fabac7354ce in clone (/lib/x86_64-linux-gnu/libc.so.6+0xf94ce)
2021-04-11 11:37:03 +02:00
Peter Keresztes Schmidt
0c3244d011
comms/Socket: Mark methods which are not meant to be overridden as non-virtual
...
This fixes the remaining Woverloaded-virtual warnings.
2021-04-11 01:28:23 +02:00
Peter Keresztes Schmidt
eacd9d4d36
comms: Add override specifier where necessary
2021-04-11 01:28:23 +02:00
Peter Keresztes Schmidt
3d2614b429
comms: Quick-fix a crash in ZM::Socket::Accept
...
mLocalAddr is always nullptr and not used anywhere. So just use a local variable for
the time being.
The comms types will need an API rework since the current one is rather convoluted.
Postpone fixing this properly until then.
2021-04-11 01:28:23 +02:00
Peter Keresztes Schmidt
d7224261f7
comms: Implement ZM::Pipe::isClosed so we have a non-abstract class
2021-04-11 01:28:23 +02:00
Peter Keresztes Schmidt
3b705c15fe
build: Store all generated sources in CMAKE_BINARY_DIR
...
config.h is already generated there so move zm_config_data.h and zm_config_define.h
there as well. Also limit the scope of CMAKE_BINARY_DIR as include directory to the zm target.
All in all this makes zm_config_data and zm_config_define available when building the tests target.
2021-04-11 01:28:23 +02:00
Peter Keresztes Schmidt
7dee86b104
comms: auto-format
2021-04-11 00:23:17 +02:00
Peter Keresztes Schmidt
f8fc768486
FifoSource: Adapt to changed xop::AVFrame API
2021-04-11 00:08:26 +02:00
Isaac Connor
1ccc416224
Merge branch 'release-1.34'
2021-04-09 20:00:47 -04:00
Isaac Connor
6f28c16915
Uwse the db queue for event updates
2021-04-09 19:45:55 -04:00
Isaac Connor
d9dc61265d
Fix DisableAlarms. Use signal when capture fails instead of erroneously using TRIGGER_OFF. Add status to DumpSettings so that we can query it with zmu.
2021-04-09 17:46:11 -04:00
Isaac Connor
4bd490d121
Set signal=true if capture succeeds.
2021-04-08 11:37:27 -04:00
Isaac Connor
2d7479cb59
reintroduce Start() methods to analysis and decoding thread
2021-04-07 20:36:38 -04:00
Isaac Connor
a63186444b
Replace char arrays with std::strings in monitor class.
2021-04-07 14:15:55 -04:00
Isaac Connor
cb7e365e35
Add locking increment_it. I think we need it.
2021-04-06 13:55:09 -04:00
Peter Keresztes Schmidt
817da4e621
Monitor: Make decoder a unique_ptr
...
The DecoderThread object is owned by the Monitor. Signal this by using unique_ptr.
2021-04-06 12:50:05 +02:00
Peter Keresztes Schmidt
fee5ecd72f
Monitor: Make analysis_thread a unique_ptr
...
The AnalysisThread object is owned by the Monitor. Signal this by using unique_ptr.
2021-04-06 12:50:05 +02:00
Isaac Connor
4c988860d5
Close events in a background thread. Add a ton more debugging
2021-04-05 12:56:13 -04:00
Peter Keresztes Schmidt
e92125afd9
utils: remove unused curl include
2021-04-04 01:18:34 +02:00
Peter Keresztes Schmidt
b5f3682d4e
utils: some more reshuffling/grouping and formatting
2021-04-04 01:18:34 +02:00
Peter Keresztes Schmidt
545f0dbb96
utils: cleanup Base64Encode
2021-04-04 00:39:40 +02:00
Peter Keresztes Schmidt
e330f8553d
utils: cleanup Split and Join
2021-04-04 00:30:18 +02:00
Peter Keresztes Schmidt
39a896f5b6
utils: cleanup StartsWith
2021-04-03 23:51:12 +02:00
Peter Keresztes Schmidt
3dbf13e00b
utils: cleanup ReplaceAll
2021-04-03 23:50:35 +02:00
Peter Keresztes Schmidt
664cd649f8
utils: cleanup Trim (was trimSet) and TrimSpaces
2021-04-03 23:30:59 +02:00
Isaac Connor
405be70430
Use packetqueue unlock to also notify
2021-04-02 21:26:01 -04:00
Isaac Connor
87fc35dbe6
Add LOW_PRIORITY to fps status updates
2021-04-02 13:09:32 -04:00
Isaac Connor
bcd0e84a31
do sws_scale from decoded image to Image using a member context and avframe to save a few cycles
2021-04-01 13:22:57 -04:00
Isaac Connor
8aceccd496
improve the message when max video packets is exceeded
2021-04-01 11:53:57 -04:00
Isaac Connor
0e00cb0289
use the new packetqueue::unlock to unlock packets and wake up decoding thread
2021-04-01 11:52:47 -04:00
Isaac Connor
6459cfb4bc
introduce packetqueue::unlock to unlock packets and notify anyone waiting. Also check for iterators pointing to packets when not keeping keyframes. Loop with waiting when we can't lock a packet
2021-04-01 11:52:28 -04:00
Isaac Connor
f52ead7cda
introduce packetqueue::unlock to unlock packets and notify anyone waiting. Also check for iterators pointing to packets when not keeping keyframes. Loop with waiting when we can't lock a packet
2021-04-01 11:52:25 -04:00
Isaac Connor
1c9bc5c27f
code doc and spacing
2021-04-01 11:51:18 -04:00
Isaac Connor
22d713cd9c
fix packetqueue corruption. Can't wait after grabbing the packet.
2021-03-31 16:49:19 -04:00
Isaac Connor
ddb62a27c6
Fix queue full message. Remove test for empty queue. We don't care if the queue is empty. Improve debug logging.
2021-03-31 16:49:19 -04:00
Isaac Connor
fd23b3e284
Adjust debug levels
2021-03-31 16:49:19 -04:00
Isaac Connor
c73393579d
Handle event creation failing gracefullyish
2021-03-31 12:06:33 -04:00
Isaac Connor
eed6a57800
remove unused member sd
2021-03-31 12:06:14 -04:00
Isaac Connor
9b4eee02d8
Make sure id is initialized to 0 so that we can test if event creation worked
2021-03-31 12:06:03 -04:00
Isaac Connor
4fb73505b9
backport change to not initialize db in logger which fixes small memleak.
2021-03-31 12:05:30 -04:00
Isaac Connor
a1364a2b2b
delete packet_lock if failed trylock
2021-03-30 16:14:42 -04:00
Isaac Connor
649f7906de
Need to track locked status so that if we fail a trylock we remember it and don't try to unlock later
2021-03-30 16:14:42 -04:00
Isaac Connor
e92dcf1457
Add special case for older ffmpeg that has different AV_CODEC define numbers
2021-03-30 14:28:40 -04:00
Isaac Connor
c7754e5be8
Default to port 5900
2021-03-30 11:37:00 -04:00
Isaac Connor
8c6f03a4e4
Move waiting for decoding down into motion detection section. Add a test for successful decode. Decode may not provide an image.
2021-03-30 09:16:45 -04:00
Isaac Connor
3202db1b33
Move waiting for decoding down into motion detection part, which is what needs it. Not sure why it was up so high. This should allow more ram freeing for people with analysis fps set to something.
2021-03-30 09:16:44 -04:00
Isaac Connor
0bfbdd6121
Use our new CODEC define to cleanup the code
2021-03-30 09:15:28 -04:00
Isaac Connor
d3ed11cc5b
add a simple define to make codec/codecpar access easier
2021-03-30 09:15:28 -04:00
Isaac Connor
1c7ae103ea
receiving a signal is not a reason to fail a capture. It is a reason to retry
2021-03-29 18:01:10 -04:00
Isaac Connor
0a364f3b80
fix weird logic in ReadData
2021-03-29 11:54:55 -04:00
Isaac Connor
6c428c0156
Properly print out timeval
2021-03-29 09:58:09 -04:00
Isaac Connor
9463cf8565
I can't imagine what fps_report_interval has to do with event being longer than section_length. Use analysis_image_count in log
2021-03-29 09:57:57 -04:00
pmccarty
e3349c54fa
Fix logic to detect libvnc shared library.
2021-03-27 10:58:30 -04:00
Isaac Connor
1d99bd5cb3
Merge branch 'max_queue_size'
2021-03-26 17:03:52 -04:00
Isaac Connor
1275948744
add cast to fix compile
2021-03-26 17:03:49 -04:00
Isaac Connor
8e40067d13
Update locks
2021-03-26 17:01:45 -04:00
Isaac Connor
52cb182ae3
Load max_image_buffer_count in monitor and set it in packetqueue. rename max_video_packet_count to pre_event_video_count in packetqueue and adjust logic. When queuing packets check to ensure that we aren't going over. Delete packets from front if possible, do not queue packet if not possible
2021-03-26 14:26:37 -04:00
Isaac Connor
3655b25b7c
spacing
2021-03-26 08:16:26 -04:00
Isaac Connor
d0a390b42f
decrease logging of nal counts
2021-03-26 08:15:55 -04:00
Isaac Connor
b6187a8e91
Allow setting the frame size
2021-03-25 13:39:07 -04:00
Isaac Connor
7038263e3b
implement a nal splitter for udp transmission
2021-03-25 13:12:52 -04:00
Isaac Connor
0c7542d20d
set hType
2021-03-25 13:12:21 -04:00
Isaac Connor
292bad8718
We can use >= instead of > to avoid an unneeded reallocation. Reduce duplicated code.
2021-03-25 12:52:41 -04:00
Isaac Connor
3f8b9db3d9
fix UriEncode returning a string that is longer than the c_str
2021-03-24 13:29:17 -04:00
Isaac Connor
79115e79f8
Fix jwt-cpp failing signature validation
2021-03-24 13:28:40 -04:00
Isaac Connor
e5a464f090
fix reverse logic on testing stop_
2021-03-23 13:53:07 -04:00
Isaac Connor
d1b816658b
code style cleanups and add debug to tell which library we are using
2021-03-23 13:52:35 -04:00
Isaac Connor
1bfc61a5b7
change log level to debug when monitor is not decoding
2021-03-23 10:32:59 -04:00
Isaac Connor
456afac0ec
Must initialize stop_
2021-03-23 10:07:55 -04:00
Isaac Connor
e51fe9eb4a
add tail_count to encode option
2021-03-22 21:31:09 -04:00
Isaac Connor
0a8b89fecd
Use pts instead of timestamp in our nal
2021-03-22 17:49:59 -04:00
Isaac Connor
96a96f4865
add jwt token as a std:;string
2021-03-22 17:49:59 -04:00
Isaac Connor
8bc22880a4
use modern threads. Add a separate thread for sending data.
2021-03-22 17:49:59 -04:00
Isaac Connor
cfff9723af
Remove h264markers cuz it's in zm_rtsp_server_frame.h
2021-03-22 17:49:59 -04:00
Isaac Connor
d2efb51b0d
rearrange a bit, put back setting width and height on video source even though it isn't used yet. Remove signal blocking stuff that we don't use
2021-03-22 17:49:59 -04:00
Isaac Connor
d84e4a14fb
Use a define when setting pipe size
2021-03-22 17:49:59 -04:00
Isaac Connor
b5f64f1c69
Merge branch 'master' of github.com:/ZoneMinder/zoneminder
2021-03-22 12:41:36 -04:00
Isaac Connor
9cb5887332
better debug logging when choosing codec
2021-03-22 12:41:30 -04:00
Isaac Connor
b8b20917be
setKeepKeyframes when not PASSTHROUGH
2021-03-22 12:05:22 -04:00
Isaac Connor
2d4b4b6022
If we already tried decoding a packet, don't try again. Also we really shouldn't be decoding in videostore.
2021-03-22 12:05:05 -04:00
Isaac Connor
3f3bc50acb
Add keep_keyframes setting. When NOT doing passthrough we don't actually have to store all packets since last keyframe, so don't do it. SImplifies clearPackets() logic a lot and will save ram for those people.
2021-03-22 12:04:32 -04:00
Isaac Connor
6d5cbe2583
Make incorrect dimensions non-fatal if the monitor dimensions are larger than what is expected, so at least there is enough ram to store the image
2021-03-22 11:02:32 -04:00
Peter Keresztes Schmidt
67d7872e9a
Eliminate non-thread-safe calls to gmtime
...
gmtime uses an internal static storage to which a pointer is given as return value.
Due to this it is not safe to call gmtime from multiple threads since the same static storage is used.
Use gmtime_r instead which allows to pass in a tm struct.
Fixes:
https://github.com/ZoneMinder/zoneminder/security/code-scanning/32
2021-03-21 21:42:02 +01:00
Peter Keresztes Schmidt
4e8c7d1f7c
Eliminate non-thread-safe calls to localtime
...
localtime uses an internal static storage to which a pointer is given as return value.
Due to this it is not safe to call localtime from multiple threads since the same static storage is used.
Use localtime_r instead which allows to pass in a tm struct.
Fixes:
https://github.com/ZoneMinder/zoneminder/security/code-scanning/24
https://github.com/ZoneMinder/zoneminder/security/code-scanning/25
https://github.com/ZoneMinder/zoneminder/security/code-scanning/26
https://github.com/ZoneMinder/zoneminder/security/code-scanning/27
https://github.com/ZoneMinder/zoneminder/security/code-scanning/28
https://github.com/ZoneMinder/zoneminder/security/code-scanning/30
https://github.com/ZoneMinder/zoneminder/security/code-scanning/31
https://github.com/ZoneMinder/zoneminder/security/code-scanning/33
https://github.com/ZoneMinder/zoneminder/security/code-scanning/58
https://github.com/ZoneMinder/zoneminder/security/code-scanning/59
https://github.com/ZoneMinder/zoneminder/security/code-scanning/63
https://github.com/ZoneMinder/zoneminder/security/code-scanning/64
https://github.com/ZoneMinder/zoneminder/security/code-scanning/65
2021-03-21 21:42:02 +01:00
Peter Keresztes Schmidt
7e86e1ef40
utils: Make TimevalToString thread-safe
2021-03-21 21:42:02 +01:00
Isaac Connor
7c9eb42ebb
Merge branch 'master' into 3197-record-event-close-mode
2021-03-21 13:03:26 -04:00
Isaac Connor
6d9a4ed661
If the analysis thread is falling behind, we can't count the packets after it in the number of packets to keep in queue. So figure out how many there are and add that to the max_video_packet count to keep so that we always have enough to satisfy pre_event_count
2021-03-21 12:28:33 -04:00
Isaac Connor
8a1d13b6cd
perror => Error()
2021-03-21 09:17:03 -04:00
Isaac Connor
a042e4bf77
spacing
2021-03-20 19:27:18 -04:00
SirLouen
db7e9edcab
Issue #3197 Improvement
2021-03-21 00:00:36 +01:00
SirLouen
33f98a0d40
Issue #3197 Add RECORD to Event_Close_Mode time
2021-03-20 20:02:52 +01:00
Isaac Connor
53133ba051
add token as an alternative to jwt_token
2021-03-18 17:43:31 -04:00
Peter Keresztes Schmidt
7a4c34ec7e
RemoteCameraHttp: Fix a log message
2021-03-18 20:02:20 +01:00
Isaac Connor
edefbfcad6
Remove assumptions about Analysis being about motion detection. Fixes mem leaks in Monitor mode
2021-03-18 09:24:27 -04:00
Isaac Connor
f4506a8f35
We always need an analysis thread.
2021-03-17 23:41:00 -04:00
Isaac Connor
ccb1bc1a7d
Have to wait until we are finished with the packet before unlocking.
2021-03-17 16:11:31 -04:00
Isaac Connor
fb28c6b365
Fix login in Decode for non-ffmpeg monitors
2021-03-17 15:53:14 -04:00
Isaac Connor
079d3361a2
Rework to read content_length bytes at once. Micro-optimisation
2021-03-17 15:52:55 -04:00
Isaac Connor
284fe52b5f
fix double stop/free of decoder and analysis threads
2021-03-17 12:57:45 -04:00
Isaac Connor
c39ec5873b
don't include zm_utils in decoder_thread
2021-03-17 12:50:13 -04:00
Isaac Connor
2b34d09b84
Move analysis_thread into Monitor. Don't do extra gettimeofday if no delays are set. Fix status update on terminate
2021-03-17 12:49:50 -04:00
Isaac Connor
feafaa29bf
improve debug logging
2021-03-17 12:49:12 -04:00
Isaac Connor
6ab8bee581
Increase debug level for fifo writing
2021-03-17 12:48:59 -04:00
Isaac Connor
0b4f04c4d5
notify in clear before taking lock to increase chance of other threads exiting. Handle terminate case in get_packet
2021-03-17 12:48:42 -04:00
Isaac Connor
9ca5f49d82
Move analysis_thread into Monitor
2021-03-17 12:48:08 -04:00
Isaac Connor
dca34544ec
move analysis thread into monitor. populate analysis_it and decoder_it in Prime instead of constantly checking for them. Handle cases where LockedPacket are null due to shutdown
2021-03-17 12:47:52 -04:00