Commit Graph

4466 Commits

Author SHA1 Message Date
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