Commit Graph

4288 Commits

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