Peter Keresztes Schmidt
6fd6654488
Monitor: Don't segfault in closeEvent if mmap is already unmapped
2021-02-08 19:47:40 +01:00
Peter Keresztes Schmidt
7e7b1a0b1f
Logger: Try harder to obtain the DB lock
...
Since we are now multi-threaded it can happen quite easily that a log message should be written to the DB on one thread while the other thread executes another query. Don't bail out immediately in the logging code, instead try to obtain the lock within 1s.
2021-02-08 19:07:01 +01:00
Peter Keresztes Schmidt
70fbc25dbd
Mutex: Change method signatures so they resemble std::unique_lock a bit more
...
try_lock_for should specify in their return value whether obtaining the lock succeeded.
2021-02-08 18:59:25 +01:00
Isaac Connor
43761a2d19
Remove instructions for trusty. Trusty is no longer supported. Apply recommendations for #3135 . Fixes #3135
2021-02-08 12:07:11 -05:00
Isaac Connor
05a115e315
Merge pull request #3141 from Carbenium/recursive-mutex
...
RecursiveMutex: Use the pthread_mutex_t of the base class
2021-02-08 11:49:35 -05:00
Peter Keresztes Schmidt
40ddca14c6
RecursiveMutex: Use the pthread_mutex_t of the base class
...
Not doing so initializes a pthread_mutex_t with PTHREAD_MUTEX_RECURSIVE in the derived class but the lock/unlock
methods still use the pthread_mutex_t instance of the base class, which is not a recursive mutex.
2021-02-08 17:33:06 +01:00
Isaac Connor
583779438b
Don't unlock db_mutex if we don't get the lock in the first place
2021-02-08 11:09:44 -05:00
Isaac Connor
192aae8e30
small space and code doc
2021-02-08 09:04:06 -05:00
Isaac Connor
01e69569eb
Placement of -- matters.
2021-02-08 09:04:06 -05:00
Isaac Connor
b75d2f6164
Don't need to set ctx to null. fre_context does it for us
2021-02-08 09:04:06 -05:00
Isaac Connor
061140958c
Only update videodata if shared_data is active
2021-02-08 09:04:06 -05:00
Isaac Connor
57f599237c
Merge pull request #3136 from Carbenium/db-connect
...
DB: Make connection initialization more predictable and finalize mysql library correctly
2021-02-08 08:43:33 -05:00
Isaac Connor
ea8fcefa4c
Merge pull request #3140 from Carbenium/local-cam-segfault
...
Monitor: Fix a segfault when loading local cameras
2021-02-08 08:41:15 -05:00
Peter Keresztes Schmidt
3376b44290
Monitor: Fix a segfault when loading local cameras
2021-02-08 12:25:18 +01:00
Isaac Connor
1b86778f71
Merge pull request #3138 from Carbenium/monitor-auto-ptr
...
Use the power of smart pointers to manage Monitor instances
2021-02-07 17:04:23 -05:00
Peter Keresztes Schmidt
f43507dce0
Use the power of smart pointers to manage Monitor instances
2021-02-07 21:20:45 +01:00
Peter Keresztes Schmidt
a3dc48b55d
Define printf format specifier for size_t types (SZFMTD)
2021-02-07 20:39:48 +01:00
Peter Keresztes Schmidt
cbb37337cb
DB: Improve resource cleanup on connection failure
2021-02-07 20:16:16 +01:00
Andrew Bauer
a2f2240039
Merge pull request #3137 from Carbenium/debian-control-typo
...
Distros/Ubuntu2004: Remove an extra newline from the control file
2021-02-07 12:40:30 -06:00
Peter Keresztes Schmidt
bccadba1f6
Distros/Ubuntu2004: Remove an extra newline from the control file
...
This breaks the build with following message:
dpkg-buildpackage: error: syntax error in debian/control at line 41: block lacks the 'Package' field
2021-02-07 19:36:05 +01:00
Isaac Connor
e5f39e78c6
Merge pull request #3133 from Carbenium/dump-packet
...
ffmpeg: exit dumpPacket early if debug logging is not enabled
2021-02-07 10:40:58 -05:00
Peter Keresztes Schmidt
cc6ea04afe
Reformat touched code
2021-02-07 13:55:08 +01:00
Peter Keresztes Schmidt
3690da90ec
DB: Call mysql_library_end when closing the connection
...
With the previous commit double initialization of the mysql library is avoided which could have led to the segfaults.
2021-02-07 13:46:33 +01:00
Peter Keresztes Schmidt
aec4dbc6ff
DB: Make connection initialization more predictable and avoid double-initialization
...
Remove calls to zmDBConnect from various places to avoid possible side-effects/double initialization.
The function should be called once from the main thread of the daemon.
Also split config loading into 2 steps: static and DB config loading. Load the static config before zmDBConnect is called so it has a chance to succeed.
2021-02-07 13:44:41 +01:00
Peter Keresztes Schmidt
938676b129
ffmpeg: exit dumpPacket early if debug logging is not enabled
2021-02-07 11:58:17 +01:00
Isaac Connor
ace93e2422
fix event start packets getting deleted while writing because we don't have a lock on them.
2021-02-06 20:11:38 -05:00
Isaac Connor
5fac0903b1
We include jquery ourselves
2021-02-06 20:11:38 -05:00
Isaac Connor
010674b3dd
Fix use of local mem in return value reported by cppcheck
2021-02-06 20:11:38 -05:00
Isaac Connor
c28e1b09e5
Fix compile when using sysv shm
2021-02-06 20:11:38 -05:00
Isaac Connor
ab2e468322
Fix resource leak on failure to load font
2021-02-06 20:11:38 -05:00
Isaac Connor
87c3a862e2
remove our copies of min() and max(). Use std::min() and std::max()
2021-02-06 16:02:09 -05:00
Isaac Connor
0b138ee687
Merge pull request #3134 from Carbenium/sort
...
Image: Replace qsort with std::sort
2021-02-06 13:14:58 -05:00
Peter Keresztes Schmidt
9dc3f15eac
Image: Replace qsort with std::sort
...
std::sort has stricter complexity requirements than qsort and can be better optimized
by the compiler due to templating.
2021-02-06 15:41:56 +01:00
Isaac Connor
7f99635763
Fix xenial builds. Fixes #3130
2021-02-05 12:30:51 -05:00
Isaac Connor
885efc27ee
adjust pts/dts on flushed video packets. Improve code comments and debugging
2021-02-04 21:38:37 -05:00
Isaac Connor
2cdf017767
Fixi endlessly writing null frames to video on close when encoding audio to aac
2021-02-04 20:40:11 -05:00
Isaac Connor
9df4487eb7
Remove code to update the frames to match videostore. they are always in sync now
2021-02-04 20:39:48 -05:00
Isaac Connor
3d20183020
Remove mp4v2
2021-02-04 17:32:53 -05:00
Isaac Connor
8f9637f21a
Merge pull request #3129 from Carbenium/cmake-reformat
...
Build: Reindent the CMakeLists
2021-02-04 17:20:34 -05:00
Isaac Connor
5ce9203d2c
add include <cstring>
2021-02-04 17:07:25 -05:00
Peter Keresztes Schmidt
a1bab9acd4
git: Add .git-blame-ignore-revs file and add previous CMake cleanup commit to it
...
This file can be passed to git blame to ignore the listed revisions. With this large
mechanistic reformats/cleanups can be done without influencing the blame-ability of the codebase.
Sample usage: git blame --ignore-revs-file .git-blame-ignore-revs path/to/file
Also one can make this permanent by using: git config blame.ignoreRevsFile .git-blame-ignore-revs
2021-02-04 22:12:09 +01:00
Peter Keresztes Schmidt
6c9983155c
Build: Reindent the CMakeLists
...
Indent with 2 spaces
Also remove expressions form closing tags. They have been made optional a while ago since they make reading rather more difficult.
2021-02-04 22:00:56 +01:00
Isaac Connor
2ee097c5f2
Merge pull request #3128 from Carbenium/int-type-macros
...
Consolidate __STDC_FORMAT_MACROS and __STDC_CONSTANT_MACROS definition
2021-02-04 14:44:51 -05:00
Isaac Connor
da4b1fe3bc
Use global FFMPEGInit(). Removed compiler warning
2021-02-04 14:07:37 -05:00
Peter Keresztes Schmidt
dd527f0888
Consolidate __STDC_FORMAT_MACROS and __STDC_CONSTANT_MACROS definition
...
Move the definitions to zm_define.h and include the header at the appropriate locations.
These macros have not been adopted by the C++11 standard.
However glibc 2.17 (CentOS 7) still depends on them to provide the macros which are guarded by these defines.
2021-02-04 19:58:29 +01:00
Isaac Connor
c57c50fd4a
Merge pull request #3123 from Carbenium/catch2
...
[RFC] Add Catch2 as C++ test framework and some exemplary tests
2021-02-04 12:57:04 -05:00
Peter Keresztes Schmidt
bb067c065b
tests: Add unit tests for JWT validation
2021-02-04 18:53:58 +01:00
Peter Keresztes Schmidt
bef4e4032f
Add Catch2 as C++ test framework
...
Use -DCMAKE_BUILD_TEST_SUITE=1 during CMake invocation to activate building the tests.
The 'tests' target builds the unit tests which can then be executed using the 'test' target.
We depend on the Catch2 version of the system.
Since development normally takes place on current OSs, this shouldn't pose a problem.
2021-02-04 18:53:54 +01:00
Isaac Connor
513739aeb5
Merge pull request #3127 from Carbenium/header-cleanup
...
Cleanup and reorganize includes
2021-02-04 12:52:04 -05:00
Isaac Connor
2f12f82e82
Merge pull request #3124 from Carbenium/codeql-warning
...
CI/GitHub: Remove checkout step which throws a deprecation warning.
2021-02-04 12:08:06 -05:00