Peter Keresztes Schmidt
e18f9e1f03
FFmpeg: Drop function which is not needed with supported ffmpeg versions
...
avformat_alloc_output_context2 was introduced in libavformat 53.2 (2011). Drop our own implementation which was used if the library version wasn't available. It isn't used anymore an causes compile warnings.
2021-02-10 00:21:23 +01:00
Peter Keresztes Schmidt
d0b80d63c3
FFmpeg: Fix a version check to avoid deprecation warnings on newer systems
2021-02-10 00:20:34 +01:00
Isaac Connor
aab3aed791
Merge pull request #3145 from Carbenium/analysis-thread
...
AnalysisThread: Move it over to std::thread
2021-02-09 09:26:47 -05:00
Isaac Connor
1bd2fd639e
Merge pull request #3147 from Carbenium/issue-3146
...
Build: Work around CMake version on Xenial not supporting cxx_std_* flags
2021-02-09 09:26:22 -05:00
Isaac Connor
98d030a5d8
Merge pull request #3148 from Carbenium/comms-namespace
...
Fix some RTSP server related crashes
2021-02-09 09:16:51 -05:00
Peter Keresztes Schmidt
23a4b5087c
RTSPServerThread: Fix a crash during construction
...
It's a bad idea to use a shared_ptr instance from which the data just got moved away. Rename the instance variable to distinguish them.
2021-02-09 14:50:07 +01:00
Peter Keresztes Schmidt
4056782954
Comms: Move all classes to ZM:: namespace
...
The Socket class collides with a class named the same way from liblive555. This confuses the linker and links the wrong object leading to a crash when connecting to the RTSP server.
2021-02-09 14:45:33 +01:00
Peter Keresztes Schmidt
426cace32e
Build: Raise required CMake version to 3.5.0
...
This is the version found in Xenial which is the oldest we support.
2021-02-09 13:20:27 +01:00
Peter Keresztes Schmidt
4ebfbdef5d
Build: Work around CMake version on Xenial not supporting cxx_std_* flags
...
Closes #3146
2021-02-09 13:20:27 +01:00
Peter Keresztes Schmidt
888ddc5d63
AnalysisThread: Sprinkle some more std::chrono
2021-02-09 12:26:53 +01:00
Peter Keresztes Schmidt
3ba8ff604f
AnalysisThread: Use std::this_thread::sleep_for instead of usleep
2021-02-09 12:26:53 +01:00
Peter Keresztes Schmidt
4cd70fec1a
Utils: Add some typedefs for std::chrono durations
2021-02-09 12:26:53 +01:00
Peter Keresztes Schmidt
b22dbd4788
AnalysisThread: Move it over to std::thread
2021-02-09 12:26:53 +01:00
Isaac Connor
11d6de1aca
Merge pull request #3144 from Carbenium/asan
...
Build: Add support for compiler specific options and ASan support
2021-02-08 17:28:18 -05:00
Peter Keresztes Schmidt
424e6e14f6
Build: Add -DASAN option to build with AddressSanitizer support
...
Use this option only for debugging purposes.
2021-02-08 23:13:31 +01:00
Peter Keresztes Schmidt
825ca07561
Build: Use zm-* interfaces to set cxx standard and warning flags
2021-02-08 23:08:22 +01:00
Peter Keresztes Schmidt
00104b020c
Build: Link our libs and executable targets against zm-core-interface
2021-02-08 23:08:22 +01:00
Peter Keresztes Schmidt
44be2ccf6c
Build: Add a set of interface targets which can be used to set compilation options
...
zm-compile-option-interface:
Use to set various compiler/linker flags
zm-feature-interface:
Use to set required compiler features.
See https://cmake.org/cmake/help/latest/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html
zm-warning-interface:
Use to set compiler warning flags. If need be a zm-no-warning-interface can be added which suppresses all warning for targets linked against it. Useful for in-tree dependencies from which we don't want compiler warnings.
zm-core-interface:
That's the interface one should normally link against to get all the options.
2021-02-08 23:08:22 +01:00
Peter Keresztes Schmidt
407ea70991
Build: Add support for compiler detection
...
Using this system we can separate settings for different compilers nicely.
2021-02-08 23:08:22 +01:00
Peter Keresztes Schmidt
36253048f5
Build: Move platform detection to its own module
2021-02-08 23:08:22 +01:00
Isaac Connor
4d0800151a
Merge pull request #3143 from Carbenium/close-event-crash
...
Monitor: Don't segfault in closeEvent if mmap is already unmapped
2021-02-08 15:32:38 -05:00
Isaac Connor
a7da2e9b8a
Merge pull request #3142 from Carbenium/log-db-lock
...
Logger: Try harder to obtain the DB lock
2021-02-08 15:30:22 -05:00
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