Isaac Connor
41dc0212e0
Move include of algorithm up to top to hopefully fix issues with min and max being defined elsewhere and so compile fails
2021-02-16 10:39:04 -05:00
Isaac Connor
a82247b105
Some cleanups in disconnect
2021-02-16 10:39:04 -05:00
Isaac Connor
a56d78bb04
Don't sleep if Analyse returns false and we are terminating
2021-02-16 10:39:04 -05:00
Isaac Connor
9c3bf0af1d
Always default to mp4 for now
2021-02-14 09:49:30 -05:00
Isaac Connor
99264e4072
Fix swscale failing on resolution change. Fixes #3161
2021-02-12 11:55:25 -05:00
Isaac Connor
5a910c4a4b
use lock_guard instead of unique_lock
2021-02-12 10:45:32 -05:00
Isaac Connor
2cb6d21faf
get rid of while loop in ::Analyze. Switch login on if Ready() to bail early so we don't indent so much.
2021-02-12 10:38:21 -05:00
Isaac Connor
4915e940b7
clean out old mutex. Add event_mutex to protect around event creation/deletion
2021-02-12 10:14:35 -05:00
Peter Keresztes Schmidt
3d759e1fe0
Monitor: Some reformatting of previously touched lines
2021-02-11 20:02:08 +01:00
Peter Keresztes Schmidt
c0151caa64
Monitor: Signal by making the camera a unique_ptr the ownership relation
...
In addition we get RAII and thus automatic destruction of the camera when the monitor is destructed.
Monitor API change: getCamera -> LoadCamera
If additional properties of the camera are needed externally they should be exposed directly via Monitor.
2021-02-11 19:22:22 +01:00
Peter Keresztes Schmidt
35514649c9
Monitor: Make audio and video streams directly accessible
...
Also remove Camera::getId() which returend the monitor ID. Since a camera is owned by an monitor, there is no need for this. Also it causes a circular include.
2021-02-11 19:22:22 +01:00
Peter Keresztes Schmidt
ede811df50
zmc: Simplify Monitor's shutdown procedure
...
disconnect() is already called in the destructor. Since `monitors` goes out of scope all instances will get automatically destructed. There is no need to manually call disconnect().
2021-02-11 19:22:22 +01:00
Peter Keresztes Schmidt
91aeb325dd
Monitor: Close monitor on destruction
...
This ensures the proper shutdown sequence when not calling Close() externally (e.g when reconnecting).
2021-02-11 19:22:22 +01:00
Peter Keresztes Schmidt
0a665c0710
Monitor: Close the associated camera when closing the monitor
...
The camera is owned by the monitor. There is no reason to keep the camera open, when the owner is closed.
2021-02-11 19:22:22 +01:00
Isaac Connor
2742485a61
Merge pull request #3157 from Carbenium/zmc-deadlock
...
Fix a possible deadlock on zmc shutdown and reconnect
2021-02-11 11:28:36 -05:00
Peter Keresztes Schmidt
42484e6434
zmc: Fix a deadlock on shutdown/reconnection
...
First stop the analysis threads, then close the monitors and thus drain the packet queues before trying to join the analysis threads since they might hang while waiting for the next packet to arrive.
2021-02-11 15:48:22 +01:00
Isaac Connor
cca4d18d26
need <algorithm> for std::max
2021-02-10 17:29:51 -05:00
Isaac Connor
51f2d120e4
Free raw image after motion detection when doing passthrough and not saving jpegs
2021-02-10 17:07:58 -05:00
Isaac Connor
393e8b582a
Move the logic of whether to queue a packet into packetqueue::queuePacket
2021-02-10 14:11:00 -05:00
Isaac Connor
0a1bd3537d
ready_count is now max(warmup_count,pre_event_count). This should ensure that we have enough packets in the packet queue when creating an event.
2021-02-10 13:54:20 -05:00
Isaac Connor
991e8dc860
Include mysqld_error.h so we can test for specific errors
2021-02-10 13:54:20 -05:00
Isaac Connor
64cfac9255
Only loop on SQL insert for wait timeout error, not others
2021-02-10 13:54:20 -05:00
Peter Keresztes Schmidt
2f5dff7244
Monitor: Don't push packets into the packet queue when in Monitor mode
...
There is no consumer for the packets in this mode, so don't queue them up. This saves quite a bit of RAM for mode of operation.
2021-02-10 16:13:47 +01:00
Peter Keresztes Schmidt
687ba03eb4
Drop relicts of zma
2021-02-10 13:26:25 +01:00
Isaac Connor
8f783c0ec4
Must also include cstdarg for va_start etc al
2021-02-09 23:32:27 -05:00
Isaac Connor
9879a40c4b
Must include cstring
2021-02-09 23:32:27 -05:00
Isaac Connor
dcf1ff3133
Merge pull request #3152 from Carbenium/ffmpeg-warnings
...
Fix some ffmpeg deprecation warnings
2021-02-09 20:15:41 -05:00
Peter Keresztes Schmidt
a66a9a6f10
Rtsp: Use AvStream.codecpar if available
...
.codec has been deprecated in libavf 57.33.100
2021-02-10 00:21:23 +01:00
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
Peter Keresztes Schmidt
0380bee130
AnalysisThread: Make the class un-movable
...
We depend on an unchanged value of "this" after the creation of the thread otherwise undefined values would be accessed within the std::thread.
2021-02-09 23:54:50 +01:00
Peter Keresztes Schmidt
8fa1249b33
Utils: Add some helper to create unique_ptrs
...
They follow the C++14 API and can be removed once the language level is increased.
2021-02-09 23:52:13 +01:00
Isaac Connor
67cd038a4f
Include pre-alarm frames in db
2021-02-09 15:33:09 -05:00
Isaac Connor
727594e3af
Fix rotated images by allocating image with camera dimensions
2021-02-09 14:53:14 -05:00
Isaac Connor
13d72bdec6
Merge branch 'master' of github.com:ZoneMinder/zoneminder
2021-02-09 14:24:20 -05:00
Isaac Connor
1780cfbff1
Add frames_duration
2021-02-09 14:23:34 -05:00
Isaac Connor
9b3d423f3d
Separate duration==endtime-starttime from Frames Duration
2021-02-09 14:22:23 -05:00
Isaac Connor
a5519075f5
Also save ALERT frames to db
2021-02-09 14:22:02 -05:00
Isaac Isaac
c233bf3463
spacing and a fix for duplicated for loop setting up rtsp server
2021-02-09 13:18:34 -05:00
Isaac Isaac
032420beb2
Don't need to init mVideoStream etc as they are done in Camera(). Set stream_index in packet.
2021-02-09 13:16:19 -05:00
Isaac Connor
05b5927f01
Don't queue audio packets if we aren't saving audio
2021-02-09 11:54:38 -05:00
Isaac Connor
1bce4f6bfa
When flushing queues, will return 0 when done. Handle it. Also set next dts from pkt, not opkt
2021-02-09 11:30:42 -05:00
Isaac Connor
e3eebeb9dd
Must return ret to handle case where ret=0.
2021-02-09 11:30:06 -05: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
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
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