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
Isaac Connor
a8d31ca686
After moving analysis thread into monitor, I don't know how to handle the shared_ptr stuff
2021-03-17 12:46:55 -04:00
Isaac Connor
657a5edda4
If decoding disabled, set signal and last_write_time in the Capture thread. So that zm_watch knows we are alive
2021-03-17 10:11:06 -04:00
Isaac Connor
6a2e237902
Fix delete packet before deleting lock on packet
2021-03-17 10:07:03 -04:00
Isaac Connor
74616d1061
Update CaptureFPS SQL to just do an update and don't use static sql. TThis may fix a signal 6 crash that we have been seeing
2021-03-17 10:06:45 -04:00
Isaac Connor
14ef8336b9
If ffmpeg and decoding Disabled don't stream
2021-03-16 20:10:00 -04:00
Isaac Connor
fe17d7bb23
Add checks for aliveness of monitor in streaming. If decoding disabled can't view stream.
2021-03-16 20:09:14 -04:00
Isaac Connor
1daafd7f85
add GetType
2021-03-16 20:08:08 -04:00
Isaac Connor
12ed02a5b0
Move trigger detection before motion detection. Only wait for decoding if decoding is enabled
2021-03-16 20:07:59 -04:00
Isaac Connor
8fa989f8e9
Increase debug level of input selection
2021-03-16 20:07:06 -04:00
Isaac Connor
c0242e7369
Fix memleak when connect fails
2021-03-16 13:28:00 -04:00
Isaac Connor
028f2dd626
Debug extra error log and code style
2021-03-16 13:27:27 -04:00
Isaac Connor
5e54a63bd5
Only load zones if doing something other than QUERY. Only delete decoder if there is one.
2021-03-16 13:26:40 -04:00
Isaac Connor
ebf1b7cbdc
Only output to stdout if mTerminalLevel is something. zms for example SHOULD not output to stdout, ever except maybe when running from terminal to debug
2021-03-16 13:26:06 -04:00
Isaac Connor
9d239219de
Break out early if no more buffer. Saves a couple cycles
2021-03-16 12:08:45 -04:00
Isaac Connor
76267bc57f
put back deleting the raw image when not saving jpegs. We only need it for the snapshot and that should be the alarmed image anyways.
2021-03-16 12:08:11 -04:00
Isaac Connor
2b0e3d0d2c
Merge branch 'decoder_thread'
2021-03-15 17:05:36 -04:00
Isaac Connor
9903e909af
Rework locking in ZMPacket by using a new class called ZMLockedPacket.
2021-03-15 17:05:30 -04:00
Isaac Connor
baf73fea7b
Ensure that we disconnect when ShmValid fails
2021-03-15 15:11:12 -04:00
Isaac Connor
6a11b23aaf
Add decoder thread
2021-03-15 15:08:59 -04:00
Isaac Connor
b238a2bc25
Implement decoder thread, locking is broken
2021-03-15 15:08:43 -04:00
Isaac Connor
f4e60be444
If we failed to bind libvnc then fail Prime to prevent crash
2021-03-14 22:08:48 -04:00
Isaac Connor
e0d54a6d11
remove deprecated reset and tidy up a bit
2021-03-13 16:30:41 -05:00
Isaac Connor
c9170a87b2
Allow users with Monitors::View to generate and cancel events
2021-03-12 09:26:56 -05:00
Isaac Connor
786adc5511
Spacing
2021-03-11 13:48:52 -05:00
Isaac Connor
28490816dc
Use new zmDbDoUpdate to end the event
2021-03-11 13:48:42 -05:00
Isaac Connor
cbec5b2800
Implement zmDbDoUpdate which returns -mysql_errer or # of rows modified
2021-03-11 13:48:16 -05:00
Isaac Connor
b5f45b0987
fix alignment of help
2021-03-11 13:16:44 -05:00
Isaac Connor
86a26ef3b1
nvsnprintf won't exceed the buffer but it can hit the end of it so adding the ending ]\n can overflow. Test and prevent.
2021-03-11 13:16:32 -05:00
Isaac Connor
43e7e612c5
Have to turn off DB logging when logging from a db query or else we infinite loop
2021-03-11 13:07:47 -05:00
Isaac Connor
f2553220b6
Implement xop::Authenticator::GetFailedResponse to return a 401
2021-03-11 11:45:39 -05:00
Isaac Connor
874e61d681
remove Base64 include from live555
2021-03-11 09:26:50 -05:00
Isaac Connor
644d6d34a4
Must init video_stream_id and audio_stream_id
2021-03-10 17:23:44 -05:00
Isaac Connor
5d968358f7
Need to use ZM::make_unique because std::make_unique is c++14
2021-03-10 16:35:03 -05:00
Isaac Connor
000df68f72
include memory
2021-03-10 16:17:26 -05:00
Isaac Connor
15bd3276d2
fix define
2021-03-10 13:50:42 -05:00
Isaac Connor
aadee4ea65
add a Query String parse in zm_utils
...
add an authenticator to use with RtspServer
2021-03-10 13:20:14 -05:00
Isaac Connor
562e7c7e80
Add authentication
2021-03-10 13:19:41 -05:00
Isaac Connor
a0957fbd10
remove debug
2021-03-10 13:19:30 -05:00
Isaac Connor
b1f6eb127b
Switch from live555 to PHZ76/RtspServer
2021-03-10 11:01:04 -05:00
Isaac Connor
831cf8af56
remove zm_video.h which is no longer relevant
2021-03-08 22:14:47 -05:00
Isaac Connor
41085c9e5c
Remove final bits of zm_video writer.
2021-03-08 22:14:13 -05:00
Isaac Connor
46bf765f80
Set heartbeat on startup. Fix logic in ShmValid
2021-03-08 18:31:01 -05:00
Isaac Connor
e38e8a2775
Actually use zmc_heartbeat_time. Set it on every capture and use it in ShmValid to determine if zmc has gone away.
2021-03-08 09:30:53 -05:00
Isaac Connor
c0990a7982
Merge pull request #3190 from Carbenium/db-locking
...
Fix SQL queries with missing lock
2021-03-06 18:51:02 -05:00
Peter Keresztes Schmidt
32f8bc8e31
Fifo: Fix a crash on shutdown
...
outfile can be undefined if the fifo couldn't be opened correctly.
Only try to close outfile on shutdown when it is valid.
2021-03-06 23:39:59 +01:00
Peter Keresztes Schmidt
0796a2262e
Utils: Replace stringtf with a type-safe version that can't overflow
2021-03-06 00:12:18 +01:00
Peter Keresztes Schmidt
9e77324de4
Replace raw mysql_query calls with the zmDb* functions
...
With this we can make sure we have proper locking of our DB connection at all times.
2021-03-06 00:12:18 +01:00
Isaac Connor
c96cb1dd8d
Put back terminate_
2021-03-05 14:21:18 -05:00
Isaac Connor
cfb8e062c1
Add deleting sources to RTSPServerThread::Stop(). Delete redundant terminate
2021-03-05 14:18:51 -05:00
Isaac Connor
ebd29a3cb9
use the timeout version of read_into so that we don't stay blocked while we have been told to exit. If getNextFrame returns -1 sleep for a second.
2021-03-05 14:18:12 -05:00
Isaac Connor
07339e443b
Add RTSP Server shutdown code
2021-03-05 14:13:24 -05:00
Isaac Connor
f99b8896ec
Don't unlock the mutex around openFile. It is a recursive mutex so we should be able to stay locked
2021-03-05 14:13:10 -05:00
Isaac Connor
0af68a0914
Implement read_into with a timeout
2021-03-05 14:12:44 -05:00
Isaac Connor
1ff4e5bc8d
Fix not keeping enough video packets in packetqueue to satisfy pre_event_count
2021-03-05 10:02:21 -05:00
Admin
fa22129966
Make last_alarm_count last alarmed frame while only in ALARM state to make post_event_count counts since here not alone alarmed frames that don't shot alarms.
2021-03-04 20:20:02 +01:00
Isaac Connor
5f476df194
Fix invalid read when no mAudioStream
2021-03-04 13:35:39 -05:00
Isaac Connor
d20521569d
Only add width and height if they have a value
2021-03-04 13:26:10 -05:00
Isaac Connor
7da1e48456
Fix delete=>delete[] on header. If we read_into the buffer more all our pointers can be invalidated. So use offsets instead
2021-03-04 13:26:10 -05:00
Isaac Connor
eb36c9e919
add getFrequencyIndex and use it to correctly set the frequency index
2021-03-04 13:26:10 -05:00
Isaac Connor
1adeda6241
Add debugging of sql
2021-03-04 13:26:10 -05:00
Peter Keresztes Schmidt
5ffaebf70d
RtpCtrlThread: Add a missing include
2021-03-04 19:21:09 +01:00
Isaac Connor
0a8b34843c
Merge pull request #3188 from Carbenium/drop-zm-thread
...
Drop our custom threading code
2021-03-04 13:02:51 -05:00
Isaac Connor
5259b78065
Fix event notes not getting populated.
2021-03-04 11:12:27 -05:00
Isaac Connor
f986b6a5e2
Clear packet counts on clear so that camera restarts don't incremenet the stream_id's and cause memory consumption
2021-03-04 07:46:39 -05:00
Peter Keresztes Schmidt
d9568a98c0
Drop zm_thread which has been replaced by STL implementations
2021-03-04 10:55:46 +01:00
Peter Keresztes Schmidt
15bb9969da
Timer: Unused, let's remove it
...
Currently there is no need for this functionality.
Since it depends on Thread and ThreadData (which will be removed) let's drop this as well.
If need would arise for such functionality a new implementation with a modern API should be written.
2021-03-03 23:38:15 +01:00
Peter Keresztes Schmidt
a78236d05c
Fifo: Fix some missing c_str()s for formatting logs
2021-03-03 23:31:53 +01:00
Peter Keresztes Schmidt
69185e2204
RtpSource: Convert ThreadData with std::condition_variable
2021-03-03 23:31:53 +01:00
Peter Keresztes Schmidt
1dfa41923b
Fifo: F_{G,S}ETPIPE_SZ is Linux specific
2021-03-03 23:31:53 +01:00
Peter Keresztes Schmidt
c7f9cc3368
LibvlcCamera: Convert ThreadData with std::condition_variable
2021-03-03 23:31:53 +01:00
Peter Keresztes Schmidt
c78e174e78
RTSPServerThread: Convert to std::thread
2021-03-03 23:31:53 +01:00
Peter Keresztes Schmidt
8f0431d85b
RtpDataThread: Convert to std::thread
2021-03-03 23:31:53 +01:00
Peter Keresztes Schmidt
71edb9d830
RtpCtrlThread: Convert to std::thread
2021-03-03 23:31:53 +01:00
Peter Keresztes Schmidt
ff2bfb58da
RtspThread: Fix an unguarded SQL query causing race conditions
2021-03-03 23:31:53 +01:00
Peter Keresztes Schmidt
8f941c75cd
RtspThread: Convert to std::thread
2021-03-03 23:31:53 +01:00
Peter Keresztes Schmidt
e67626b4e2
logger: Move log_mutex to std::recursive_mutex
2021-03-03 23:31:53 +01:00
Isaac Connor
20fe6153d5
Don't treat data packets as video
2021-03-03 15:52:39 -05:00
Isaac Connor
d34d2e2398
Use a define to deal with the codec/codecpar version problem
2021-03-03 15:43:59 -05:00
Isaac Connor
253ed928ec
Fix using wrong stream to set codec_type
2021-03-03 15:24:11 -05:00
Isaac Connor
8a33fb6665
Include codec_type in stream and packet dumps
2021-03-03 15:23:58 -05:00
Isaac Connor
eaaf04420a
Keep track of stream last_pts. So we can at least try to sync streams
2021-03-03 12:45:05 -05:00
Isaac Connor
3149ba276f
audio_in_stream_id is dprecated
2021-03-03 12:44:45 -05:00
Isaac Connor
b87d859f72
Set the packet's stream_index to the packetqueue stream. Rename get_ functions to get
2021-03-03 12:06:34 -05:00
Isaac Connor
a90ec5b15d
Deprecate video_in_stream_index and audio_in_stream_index as they are not useful
2021-03-03 12:03:36 -05:00
Isaac Connor
a01a24ec36
Add loading SecondPath in monitor
2021-03-03 09:56:33 -05:00
Isaac Connor
9310825d93
Add get_video_stream and get_audio_stream.
2021-03-03 09:56:31 -05:00
Isaac Connor
e31c87193d
Make Open() return 1 instead of 0
2021-03-03 09:55:57 -05:00
Isaac Connor
4cc1da8b89
Add SecondFormatContext and open it using an FFmpeg_Input
2021-03-03 09:55:57 -05:00
Isaac Connor
86541779d9
Add SecondFormatContext
2021-03-03 09:55:57 -05:00
Isaac Connor
95fe689d58
WIP, rabbit hole too deep
2021-03-03 09:55:57 -05:00
Isaac Connor
0550e69224
Fix compile on old avcodec
2021-03-03 09:55:57 -05:00
Isaac Connor
dcd1804b4d
add get_format_context()
2021-03-03 09:52:44 -05:00
Isaac Connor
46ec4e75d4
Check codec type instead of stream_index to determine video/audio
2021-03-03 09:52:27 -05:00
Isaac Connor
cf27482ebe
Change api of packetqueue. stream_index will not be incoming stream_index it will be a packetqueue specific stream_index.
2021-03-03 09:52:13 -05:00
Isaac Connor
9f5f215ef4
Check codec type instead of stream_index to determine video/audio
2021-03-03 09:51:43 -05:00
Isaac Connor
53425257cb
Handle old avcodec
2021-03-02 16:20:57 -05:00
Admin
4ff016c991
Make capturing/analysing log lines follow same pattern
2021-03-02 20:51:16 +01:00
Isaac Connor
be1b439dcc
Add State_Strings and code cleanup. Fix not going into alarm state when already recording. Fixes #3184
2021-03-02 14:42:54 -05:00
Isaac Connor
1c40145e89
not finding space for pts is debug now and show the contents of header
2021-03-02 12:41:26 -05:00
Isaac Connor
f35a1c70c0
fix build with old avcodec for xenial
2021-03-02 12:07:51 -05:00
Isaac Connor
c03d9b2987
Set state before we write packets to event so that the event knows that it is alarmed
2021-03-02 11:47:55 -05:00
Isaac Connor
f8b7ec8cb9
Save frames when in ALARM state so that pre-event frames get stored
2021-03-02 11:47:38 -05:00
Isaac Connor
71d65685b9
Can't clear image data early. Might be needed for snapshot and pre alarm farmes
2021-03-02 11:12:57 -05:00
Isaac Connor
3dc4bf265e
Use braces
2021-03-02 10:15:21 -05:00
Isaac Connor
205ed4c510
EAGAIN happens when no one is listening. Make it a debug
2021-03-02 10:14:25 -05:00
Isaac Connor
46743ebaab
Silence compile warning
2021-03-02 10:00:48 -05:00
Isaac Connor
832eabbd79
Don't both updating analysis fps unless we are doing motion detection
2021-03-02 09:59:32 -05:00
Isaac Connor
d92da5f633
Merge pull request #3185 from Carbenium/jwt-cpp
...
dep/jwt-cpp: Update to version 0.5
2021-03-01 18:42:25 -05:00
Peter Keresztes Schmidt
37817f6ba4
dep/jwt-cpp: Update to version 0.5
...
Fixes some compile warnings. Unit tests pass with this version as well.
2021-03-01 23:14:56 +01:00
Isaac Connor
1bc5abb9e9
Only include video packets in analysis_image_count
2021-03-01 17:07:09 -05:00
Isaac Connor
7c71c1c543
fix rebase error
2021-03-01 17:06:53 -05:00
Isaac Connor
51c19912f8
Use analysis_image_count in opening new event log line
2021-03-01 16:56:47 -05:00
Isaac Connor
82dcd87a22
Add generic fifo_audio_source
2021-03-01 16:49:27 -05:00
Isaac Connor
8f001413f2
Handle hevc as the codec name as well as h265
2021-03-01 16:49:27 -05:00
Isaac Connor
53059aebf3
rename numChannels to getChannels and samplingFrequency to getFrequency
2021-03-01 16:49:27 -05:00
Isaac Connor
b86e7eefbf
fix needed line break before dimensions. Update h265 auxline processing to match h264
2021-03-01 16:49:27 -05:00
Isaac Connor
d33540c962
Fix logic on clearing frame queue
2021-03-01 16:49:27 -05:00
Isaac Connor
495e2a4827
Add setting up the config string and population of mAuxLine
2021-03-01 16:49:27 -05:00
Isaac Connor
b2ff9af238
Add setting of frequency and channels for audio stream
2021-03-01 16:49:27 -05:00
Isaac Connor
b09fe1d17c
Create fifo if it doesn't exist already
2021-03-01 16:49:27 -05:00
Isaac Connor
9302c9506e
Add audio_frequency and audio_channels to shared mem and set them in PrimeCapture
2021-03-01 16:49:27 -05:00
Isaac Connor
8500c7ee94
Add audio_frequency and audio_channels to shared mem
2021-03-01 16:49:27 -05:00
Isaac Connor
c5ee837b9b
Add getFrequency and getChannels
2021-03-01 16:49:27 -05:00
Isaac Connor
cc80ae37fb
Add a generic fif_audio_source class
2021-03-01 16:49:27 -05:00
Isaac Connor
b4fc782778
fifo.h got split into zm_fifo and zm_stream so update the code in zms
2021-03-01 16:49:27 -05:00
Isaac Connor
8c2e6589ac
fifo.h got split into zm_fifo and zm_fifo_debug so update the code in zm_zone
2021-03-01 16:49:27 -05:00
Isaac Connor
8af7e40ea1
Use fifo version of code
2021-03-01 16:49:27 -05:00
Isaac Connor
bfc12384f6
Increase debug level of auxline reporting
2021-03-01 16:49:27 -05:00
Isaac Connor
6d938817b1
Rework to use a fifo source instead of Device. We no longer pass the monitor in and only open 1 port. Add addFifo function and addSession function
2021-03-01 16:49:27 -05:00
Isaac Connor
db13b4c3b6
Document possible parameters, don't add a newline to auxline
2021-03-01 16:49:27 -05:00
Isaac Connor
19d9812a3f
Add a debug function to print out the start of the nal
2021-03-01 16:49:27 -05:00
Isaac Connor
53851b67c7
use a Buffer to implement the simple ZM header protocol for passing packet data from ZM to RTSP Server
2021-03-01 16:49:27 -05:00
Isaac Connor
c716e8c149
Add logging of audio auxLine. Default to 8000Hz
2021-03-01 16:49:27 -05:00
Isaac Connor
7ba6e45505
Rough in rtsp_server concept. Wait for fifo's to exist before connecting. Check for monitor disconnection. WIP
2021-03-01 16:49:27 -05:00
Isaac Connor
449b547f2b
Use buffer.head() instead of casting
2021-03-01 16:49:27 -05:00
Isaac Connor
05e7d76ccd
Add pts which will be scaled to AV_TIME_BASE_Q
2021-03-01 16:49:27 -05:00
Isaac Connor
6e73c08a21
add fifo's for video and audio. Write the packet data to them. Update FifoStream->Fifo
2021-03-01 16:49:26 -05:00
Isaac Connor
a81e3d6e19
Set zm_packet.pts scaled to AV_TIME_BASE_Q.
2021-03-01 16:47:18 -05:00
Isaac Connor
c554a22374
use .head() instead of casting the buffer
2021-03-01 16:47:18 -05:00
Isaac Connor
1d73087e5b
Split zm_fifo up into zm_fifo, zm_fifo_debug and zm_fifo_stream. Implement a Fifo class to keep the filehandle open.
2021-03-01 16:47:18 -05:00
Isaac Connor
3ad76f18ec
code style updates
2021-03-01 16:47:18 -05:00
Isaac Connor
2d0a8549af
Fix cmake to only build zm_rtsp_server if it is turned on
2021-03-01 16:47:17 -05:00
Isaac Connor
cafdd02307
Remote rtsp server code. It got moved to zm_rtsp_server.cpp
2021-03-01 16:46:48 -05:00
Isaac Connor
6c6d6c51b0
Add RTSPSTreamName loading and write packet data to the video and audio fifos
2021-03-01 16:46:48 -05:00
Isaac Connor
3e9a2f2651
It is actually importatnt that smInstance get cleared. The subsequent new Logger will check for it.
2021-03-01 16:46:48 -05:00
Isaac Connor
57585e4986
Not sure why raw_fd should be static...
2021-03-01 16:46:48 -05:00
Isaac Connor
78062a03ef
Add writePacket and write static function to write h264 packet stream and audio stream to a fifo for the zm_rtsp_server to read from
2021-03-01 16:46:48 -05:00
Isaac Connor
d2e1c23140
Add zm_rtsp_server build target and source files
2021-03-01 16:46:48 -05:00
Isaac Connor
fdf1fbd497
Add a fifo version of the rtsp server
2021-03-01 16:46:48 -05:00
Isaac Connor
430f839954
add video_fifo filename strings to shmem.
2021-03-01 16:46:48 -05:00
Isaac Connor
33dbcc449a
Merge pull request #3181 from Carbenium/rgb-const
...
rgb: Convert some constant defines to constexpr
2021-03-01 09:40:39 -05:00
Isaac Connor
71d864d77b
Merge pull request #3182 from Carbenium/monitor-includes
...
monitor: Move system includes back to their original location
2021-03-01 09:40:08 -05:00
Peter Keresztes Schmidt
3b3ecb89b2
monitor: Move system includes back to their original location
...
41dc0212e0
moved the system includes to work around some compilation problems.
The underlying cause has been fixed in cf9406a1e8
.
Thus we can move the includes back so the follow the project-wide order.
2021-03-01 00:45:57 +01:00
Peter Keresztes Schmidt
76e6c468e8
rgb: Convert some constant defines to constexpr
...
Using defines interferes with fmt.
Also rename them according to the Google styleguide.
2021-03-01 00:38:21 +01:00
Admin
741e67e8cd
ALERT also mean warming up with alarm_frame_count value before returning to ALARM....
2021-02-28 22:42:29 +01:00
Peter Keresztes Schmidt
c33b5a4393
Move in-tree dependencies to their own folder
...
src/ should only contain our code. Move the in-tree dependencies to dep/
This allows us (if necessary) to e.g. exclude that part of the tree from being analyzed by
various tools or mark it as external code in IDEs.
2021-02-28 02:12:07 +01:00
Peter Keresztes Schmidt
866bcc9518
build: Cleanup CMakeLists.txt of libbcrypt
...
Remove unnecessary cruft and make sure it uses our compile options as dictated by zm-dependency-interface.
An additional step towards a warning-free compile.
Define __SKIP_GNU on BSD since they have their own bcrypt implementation.
2021-02-28 02:12:07 +01:00
Peter Keresztes Schmidt
6b7b23970b
build: Add a CMakeLists.txt for jwt-cpp
...
This allows us to use a cmake link target to import the library.
2021-02-27 18:18:35 +01:00
Peter Keresztes Schmidt
6a47780f60
Fix a warning reported by -Wextra
...
/home/peterke/DEV/zoneminder/src/zm_monitor.h: In member function ‘Monitor::TriggerState Monitor::GetTriggerState() const’:
/home/peterke/DEV/zoneminder/src/zm_monitor.h:499:76: warning: enumerated and non-enumerated type in conditional expression [-Wextra]
499 | TriggerState GetTriggerState() const { return (TriggerState)(trigger_data?trigger_data->trigger_state:TRIGGER_CANCEL); }
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-02-27 01:27:58 +01:00
Peter Keresztes Schmidt
814953b331
Fix warnings reported by -Wimplicit-fallthrough
...
Note: Once C++17 is supported switch to the standard conform [[fallthrough]] attribute.
For the time being [[gnu::fallthrough]] can be used since it is supported by GCC and Clang [1].
[1] https://clang.llvm.org/docs/AttributeReference.html#fallthrough
2021-02-27 00:29:35 +01:00
Peter Keresztes Schmidt
403061a39c
Fix warnings reported by -Wmissing-field-initializers
2021-02-26 22:46:09 +01:00
Peter Keresztes Schmidt
dffb2d2c87
Fix warnings reported by -Wignored-qualifiers
2021-02-26 19:31:32 +01:00
Isaac Connor
b8fcd7c85f
Merge pull request #3172 from Carbenium/db-queue-move
...
db: Make sure to bind only rvalues when pushing to zmDbQueue
2021-02-25 17:19:11 -05:00
Peter Keresztes Schmidt
3dd52a92eb
db: Make sure to bind only rvalues when pushing to zmDbQueue
...
With this we can ensure that no copy-construction of the SQL string takes place.
Regarding calling semantics: The pushed SQL string will be moved and cannot be reused.
2021-02-25 23:08:43 +01:00
Isaac Connor
3ce4b3e657
Keep capture_delay in useconds instead of msecs. Fix fps by adding back in the previous sleep_time. Fix crash due to capture_image not being asigned for local cameras
2021-02-25 16:58:54 -05:00
Isaac Connor
224fcd2cd3
Merge branch 'master' of github.com:ZoneMinder/zoneminder
2021-02-25 14:58:45 -05:00
Isaac Connor
8aeb4ab758
Switch db_mutex to a std::mutex. Use modern locking with it. Use zmDbDo or dbQueue.push where appropriate. code cleanup.
2021-02-25 12:26:26 -05:00
Isaac Connor
fdf515ca10
rough in a db queue thread. Use it in zm_logger so that we don't have to aquire the db lock
2021-02-24 19:59:55 -05:00
Isaac Connor
6f89eba154
add missing ()
2021-02-24 13:48:59 -05:00
Isaac Connor
778a4f1d84
We cannot wait for the db lock. Do not wait.
2021-02-24 13:48:36 -05:00
Isaac Connor
9959464ef7
Fix ]\n being included in the db Logs entry. Also removes a strlen so performance should improve
2021-02-24 12:37:09 -05:00
Isaac Connor
58e3d96f8c
Instead of using basename and doing a strdup etc, just use strrchr because the filepath is going to one of the sources files in zm.
2021-02-24 12:23:02 -05:00
Isaac Connor
099ca9251c
Only init camera if capturing
2021-02-24 10:33:29 -05:00
Isaac Connor
381b7e1b25
Don't disconnect/reconnect while PrimeCapture is failing. Don't sleep if there is failure in capturing and zm_terminate is set.
2021-02-24 10:29:26 -05:00
Isaac Connor
c8abeddc9c
swscale is a problem. When to use alignment/padding? Defaulting to alignment=1 makes libvnc work, but is less performant. Some scale operations require padding.
2021-02-24 10:10:37 -05:00
Isaac Connor
3ce0564e9c
Code style spacing and cleanups.
2021-02-24 10:10:37 -05:00
Isaac Isaac
3eb67fa2fc
We have to Prime every monitor not just the first one.
2021-02-23 13:12:40 -05:00
Isaac Isaac
f2143fd092
Improve debug logs
2021-02-23 13:12:09 -05:00
Isaac Isaac
3225851224
Move call to Initialise into Constructor making sure that it only gets called once. Move channel switching out of PostCapture into just after capturing image in order to free up more time for image to stabilise while we do other things like timestamping etc which happen in Capture.
2021-02-23 13:11:34 -05:00
Isaac Connor
0ac3e6fd5b
remove unneeded strlen
2021-02-22 20:40:30 -05:00
Isaac Connor
64c601fc7b
Must fix_deprecations on both values
2021-02-22 20:40:30 -05:00
Isaac Connor
62da77db50
Don't set a default crf. Many codecs don't support it. Failure to open encoder should only be a warning if we have specified it
2021-02-22 20:40:30 -05:00
Isaac Connor
730cd815d3
Add frame format to debug logging. Use fix_deprecated_fmt to fix when ctx->fmt is yuvj420p instead of yuv420p
2021-02-22 15:48:16 -05:00
Isaac Connor
8a417bb8d2
Add override to processCommand declarations. Remove unused fd var
2021-02-22 08:15:48 -05:00
Isaac Connor
5f207664d5
Add override to processCommand declarations.
2021-02-22 08:15:36 -05:00
Isaac Connor
6c013f0e65
Put back includes needed on FreeBSD. Fixes #3165
2021-02-22 08:03:10 -05:00
Isaac Connor
88f3d732b4
Always use AV_TIME_BASE_Q in video encoding mode as we use packet->timestamp instead of pts. Fixes duration problems with encoded video. Fixes #3160
2021-02-22 11:17:17 -05:00
Isaac Connor
7a17a6f9e8
Fix always returning YUV420P despite being valid format.
2021-02-22 11:14:00 -05:00
Isaac Connor
7c042c7837
If doing encoding, we don't care about keyframe
2021-02-21 20:24:36 -05:00
Isaac Connor
e562888ed0
Fix crash when decoder returns 0 and when are using hwaccel
2021-02-19 21:03:10 -05:00
Isaac Connor
bf0ae8b270
use fix_deprecated_pix_fmt function. Fix logic on out_buffer_size.
2021-02-19 20:43:24 -05:00
Isaac Connor
86d424baf0
Move closeEvent to Close(). If we are closing the camera, we have to close the event as well.
2021-02-19 20:42:36 -05:00
Isaac Connor
f440ecb235
Add dlcose, and a resize() function to allocate the framebuffer our own way
2021-02-19 20:42:07 -05:00
Isaac Connor
a5ad7462e0
add dlclose
2021-02-19 20:41:41 -05:00
Isaac Connor
16773573ad
Since audio encoding uses it's own pts counting, we don't need to copy the ipkt.
2021-02-19 16:36:06 -05:00
Isaac Connor
2f917b4fac
Must copy input packet before modifying pts/dts.
2021-02-19 15:58:49 -05:00
Isaac Connor
507cbf7f0f
Remove some debugging
2021-02-19 15:56:42 -05:00
Isaac Connor
b9669ad69f
Log new signal on signal change
2021-02-19 15:56:30 -05:00
Isaac Connor
d8e37945a3
TRY OUT SWS_POINT|SWS_BITEXACT scaling
2021-02-19 13:44:37 -05:00
Isaac Connor
415dd83d06
spacing
2021-02-19 12:44:24 -05:00
Isaac Connor
551e35b4bf
dump incoming video packet for debug
2021-02-19 12:44:24 -05:00
Isaac Connor
d85e4121ef
set pts of dest_frame to make debug less confusing
2021-02-19 12:44:24 -05:00
Isaac Connor
ed6fc9fca6
use av_frame_copy_props to copy frame members instead of doing it manually
2021-02-19 12:44:24 -05:00
Isaac Connor
2c0261bef4
Include time_base in DUMP_PACKET
2021-02-19 12:44:24 -05:00
Isaac Connor
124d9bf798
Fix logging when holding db lock
2021-02-19 12:09:02 -05:00
Isaac Connor
3dab7d3ecc
Don't need to Disconnect when Capture will return -1, as we will call Close() which calls Disconnect()
2021-02-19 12:08:48 -05:00
Isaac Connor
4ba290a9ca
Use zmDbDo where appropriate and fix some logging while holding the lock
2021-02-19 12:08:19 -05:00
Isaac Connor
d8afd58072
Remove 1 seconds sleeps from db timeout loops. 1 second is a long time. Remove UpdateFramesDelta code which is no longer needed
2021-02-19 12:07:59 -05:00
Isaac Connor
a8e63e4f20
watch for zm_terminate in db while loops
2021-02-19 12:07:12 -05:00
Isaac Connor
964b3dd05a
Merge branch 'master' of github.com:zoneminder/ZoneMinder
2021-02-19 09:03:31 -05:00
Isaac Connor
045cd219f8
Move clear packetqueue logic to it's own function and call it from the analysis thread.
2021-02-18 19:25:40 -05:00
Isaac Connor
78a5e78e4c
Add locking to get_event_start_it. Packets could get deleted while we are figuring this out.
2021-02-18 16:59:17 -05:00
Isaac Connor
0b0df96271
Merge branch 'master' of github.com:ZoneMinder/zoneminder
2021-02-18 16:05:10 -05:00
Isaac Connor
5ad9244a73
Use new db utility functions to simplify event creation code
2021-02-18 16:01:45 -05:00
Isaac Connor
63a45888a0
Introduce utility functions zmDbDo and zmDbDoInsert.
2021-02-18 16:01:30 -05:00
Isaac Connor
bc41cd944e
Add missing db_lock.unlock()
2021-02-18 15:00:30 -05:00
Isaac Connor
9502762ce8
WIP cleanup. Don't need to malloc ram as rfbInit will do it. We may need to allocated a larger buffer though, so may need to give vncserver a different malloc function
2021-02-18 13:47:27 -05:00
Isaac Connor
a4d8ef5d8f
Use new version of fix_deprecated_pix_fmt
2021-02-18 13:47:27 -05:00
Isaac Connor
6d8a7a7a4c
add SWSCale::GetBufferSize to reduce duplicated lines of code. Makes input buffer size not have to match the aligned size. Reading from doesn't generally cause a crash.
2021-02-18 13:47:27 -05:00
Isaac Connor
127e15ba3a
Don't crash if we ask for packet count of an invalid stream
2021-02-18 13:47:27 -05:00
Isaac Connor
c7dede0083
Cleanups in connect/disconnect
2021-02-18 13:47:27 -05:00
Isaac Connor
8a329df5ec
change how fix_deprecated_pix_fmt works to return a value so we can use it elsewhere
2021-02-18 13:47:27 -05:00
Isaac Connor
04c13c6ff3
Handle value of auto for encoder
2021-02-18 13:30:38 -05:00
Isaac Connor
0d59584250
Only set DefaultVideo if we are successful at opening videoStore. Set save_jpegs flag in db record if we turn it on after failing videoStore.
2021-02-18 13:30:05 -05:00
Isaac Connor
f05488ee49
better error message when can't set crf
2021-02-18 11:55:09 -05:00
Isaac Connor
b40a31d76f
Move content of setMaxVideoPcakets into .cpp
2021-02-18 11:54:50 -05:00
Isaac Connor
b1f337b6e7
Move setMaxVideoPackets down to where pre_event_count has a value
2021-02-18 11:54:32 -05:00
Isaac Connor
3e10c3a8a4
Fix return codes
2021-02-17 16:42:48 -05:00
Isaac Connor
2a49bd124f
Add VNC monitor type
2021-02-17 16:39:16 -05:00
Isaac Connor
cf6d2caef7
Make setting fmt non fatal.
2021-02-17 16:34:19 -05:00
Isaac Connor
cf9406a1e8
undef max if defined in rfb/rdbclient.h
2021-02-17 13:40:12 -05:00
Isaac Connor
33b9dae0f2
fix use of uint32_t for buffer indexes
2021-02-17 13:38:52 -05:00
Isaac Connor
f061c25183
Make failure to set video standard non-fatal.
2021-02-17 11:02:56 -05:00
Isaac Connor
519e39b4f4
Reloading has to stop other threads while we are re-initing the logs. So move it down
2021-02-17 10:07:36 -05:00
Isaac Connor
59cdf971fa
convert last_read_index and last_write_index to int32_t so that we can have -1 as a value in other functions.
2021-02-16 14:43:52 -05:00
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