Commit Graph

60 Commits

Author SHA1 Message Date
Isaac Connor
df6c4a4a13 fix: address multiple bugs across core source files
- zm_analysis_thread.cpp, zm_decoder_thread.cpp: Fix potential deadlock
  in Start() by calling Stop() before joining thread
- zm_camera.cpp: Add null check after avformat_alloc_context()
- zm_comms.cpp: Fix memory leak in InetSocket::bind(), fix error message
  typo in deleteReader(), fix clearReaders/clearWriters to recalculate
  mMaxFd properly
- zm_config.cpp: Fix potential buffer underrun when parsing config files,
  fix misplaced SERVER_ID check logic
- zm_db.cpp: Fix logger level not restored on early return in zmDbDo(),
  fix empty string access in DB_HOST parsing
- zm_event.cpp: Fix typo "foudn" -> "found", fix memory leak with Tag
  allocation, fix variable shadowing with video_file
- zm_event_tag.cpp: Fix null dereference when AssignedBy is NULL
- zm_eventstream.cpp: Fix dangling pointer bugs with emplace_back
  (use auto& instead of auto), fix memory leak in loadInitialEventData

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 10:18:49 -05:00
Isaac Connor
dd4a055717 fix: move mVideoStreamId assignment inside null check
If avformat_new_stream() returns nullptr, the code would log an error
but then still dereference mVideoStream to get the index, causing a
null pointer dereference crash.

Move the assignment inside the if block where mVideoStream is known
to be valid.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 20:35:58 -05:00
Aaron Kling
c4683d90a9 Format code using astyle google format
Commands used:
astyle --style=google --indent=spaces=2 --keep-one-line-blocks src/*.cpp
astyle --style=google --indent=spaces=2 --keep-one-line-blocks src/*.h
2024-03-26 13:43:58 -05:00
Isaac Connor
db135cba46 Add isPrimed to camera class instead of it just being in ffmpeg_camera. Rename mCanCapture to isPrimed in ffmpeg_camera. 2023-12-06 09:38:38 -05:00
Isaac Connor
61e5527b63 Log image size as wel 2022-11-30 13:18:13 -05:00
Doug Nazar
74f8e43b12 Cast operand to larger destination size to avoid possible overflow issues. 2022-07-31 00:48:27 -04:00
Isaac Connor
cecb8f65b7 Try out close_input instead of free_context 2022-06-08 23:27:51 -04:00
Peter Keresztes Schmidt
2d71743372 FFmpeg: Remove code paths required only by 2.8 and older
With Xenial support dropped we require FFmpeg 3.2 and newer.
2021-06-05 20:40:12 +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
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
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
86541779d9 Add SecondFormatContext 2021-03-03 09:55:57 -05:00
Peter Keresztes Schmidt
f43507dce0 Use the power of smart pointers to manage Monitor instances 2021-02-07 21:20:45 +01:00
Isaac Connor
513739aeb5 Merge pull request #3127 from Carbenium/header-cleanup
Cleanup and reorganize includes
2021-02-04 12:52:04 -05:00
Peter Keresztes Schmidt
0dbc39ee25 Cleanup and reorganize includes
With this commit a unified structure for includes is introduced.
The general rules:
 * Only include what you need
 * Include wherever possible in the cpp and forward-declare in the header

 The includes are sorted in a local to global fashion. This means for the include order:
  0. If cpp file: The corresponding h file and an empty line
  1. Includes from the project sorted alphabetically
  2. System/library includes sorted alphabetically
  3. Conditional includes
2021-02-04 18:02:01 +01:00
Isaac Connor
ad9fd05955 When allocating mVideoStream, set mVideoStreamId as well 2021-02-04 10:28:17 -05:00
Isaac Connor
28d27cc30a use camel case on video_stream and audio_stream 2021-01-28 10:45:19 -05:00
Isaac Connor
4c933f82b8 All cameras will have an mFormatConext, CodecContext etc. Consolidate code in zm_camera. Fix remote rtsp decoding 2021-01-27 16:12:32 -05:00
Isaac Connor
66c78e5a9b Merge branch 'zma_to_thread' into rtsp_server 2021-01-19 13:43:25 -05:00
Isaac Connor
a39a656373 Merge branch 'master' into zma_to_thread 2020-09-29 11:02:40 -04:00
Peter Keresztes Schmidt
8f980a1168 Convert NULL/0 to nullptr
The 0 -> nullptr changes should definitely improve readability.
2020-08-26 22:03:40 +02:00
Isaac Connor
869860bb26 Merge branch 'master' into zma_to_thread 2020-07-21 17:49:39 -04:00
Isaac Connor
864cd4c178 introduce a linesize variable which represents the # of bytes to hold a line of the image in the buffer. May be > width * colours 2020-07-05 17:51:57 -04:00
Isaac Connor
279e0d8bcf Merge branch 'storageareas' into zma_to_thread 2019-02-22 11:39:58 -05:00
Isaac Connor
443fd35d99 Fix imagesize requirements (#2404)
* introduce non-loop-unrolled version of function and use them when the image size is not a multiple of 12 or 16

* Remove tests for imagesize being a multiple of 16 or 12 to handle functions with unrolled loops

* Use non-unrolled functions when image size is not a multiple of 12 or 16

* use std_blend when image is odd size
2019-02-22 09:44:57 -05:00
Isaac Connor
d3c95ea144 fix merges 2018-05-12 19:44:20 -04:00
Isaac Connor
c3053a2f8a Merge branch 'storageareas' into zma_to_thread 2018-05-10 17:51:38 -04:00
Isaac Connor
4d4a7a4221 Initialize bytes to zero in camera constructor. 2018-05-07 10:27:06 -04:00
Isaac Connor
bc525a4e01 blah 2017-12-02 13:55:26 -05:00
Isaac Connor
74650ebc70 simplify Analysis 2017-11-20 11:48:56 -05:00
Isaac Connor
22ff831859 more cppcheck recommendations 2017-11-16 21:21:56 -05:00
Isaac Connor
fd44ff4e60 Merge branch 'master' into storageareas 2017-05-10 13:16:08 -04:00
Kfir Itzhak
71e6735b60 Neon32 functions now work on 64 bytes at a time. This results in 4-6x performance increase over standard functions
Memory allocations and image size requirements changed to be as needed for 64 byte alignment.
Self-test code for Blend modified accordingly and added Self-test for the delta functions.
2017-04-16 10:57:37 +03:00
Isaac Connor
bdb6dd63a3 change type of width and height to unsigned int and recording from bool to timeval 2017-04-12 13:32:22 -04:00
Isaac Connor
5ae34a7561 Merge branch 'master' into storageareas 2017-01-02 09:39:10 -05:00
Andy Bauer
254fcbcef7 update gpl 2 mailing address in source files 2016-12-26 09:23:16 -06:00
Isaac Connor
3a06ba7a65 Turn off instantiating a default zone before even loading the zones. Implement the use of Camera->setMonitor so that the camera object doesn't have to load it later. 2016-09-09 09:15:04 -04:00
Isaac Connor
62a2ce56fb Merge Rotation/Orientation work, rename id to monitor_id in cameras and also make it an unsigned int since logically that is what it is. Also some fixups for bad rtsp h264 streams. 2016-08-10 12:19:53 -04:00
Isaac Connor
e29a0ebe71 Merge branch 'feature-h264-videostorage' into storageareas 2016-06-21 13:48:32 -04:00
Isaac Connor
6a8db582ff whitespacing updates 2016-06-21 12:21:18 -04:00
Isaac Connor
71e9553648 add rotation to video 2016-05-13 14:51:26 -04:00
Steve Gilvarry
da157f5a1a Merge remote-tracking branch 'upstream/master' into feature-h264-videostorage 2016-04-30 22:27:10 +10:00
Isaac Connor
9a795432cf merge all the commits from the messed up iconnor_video branch 2016-04-05 17:14:46 -04:00
Isaac Connor
03b1ced568 tabs to spaces and use 2space indenting 2016-04-04 10:11:48 -04:00
Isaac Connor
c7e766faef finish the record_audio constructor defs 2016-03-31 13:30:31 -04:00
Isaac Connor
4e8255c80a Add record_audio member 2016-03-31 12:16:50 -04:00
Kfir Itzhak
33119c6dc5 1) Added image size requirements to ensure proper alignment
2) Changed image class buffer related functions
3) Improved format selection for local cameras
4) Removed imagesize check for swscale
5) Fixed mmap unexpected memory size when changing capture options
6) Fixed unrelated bug in zmdc.pl: sockets directory doesn't exist
2012-02-01 07:33:20 +02:00
Kfir Itzhak
4a59761bcc Getting closer and closer everyday.
1) Fixed many errors to get it to compile
2) Fixed some small bugs
3) Small other changes
2012-02-01 07:33:20 +02:00
Kfir Itzhak
5c418133bf Lots accomplished!
1) Delta and blend SSE and standard alogirthms inside
2) Changed event streaming to use sendfile() syscall if available
3) Direct memory capture (Less memcpys required)
4) Added macros for BGR24 and RGB32(and its variants) formats
5) Modified Monitors database table to add a target colorspace option
6) Changed most image buffer allocations to be on 16 byte boundary, work still in progress
7) Added Target colorspace instead of the old colours selection. this one also visible to local cameras
8) Replacing Y deltas option with ZM_CPU_EXTENSIONS
9) Added SSE detection code
10) Changed some code to make linking success with inlining enabled.
11) Some other changes and work still in progress for some listed above
2012-02-01 07:33:20 +02:00
stan
28692c1b28 Fixed greyscale issue and don't do format conversion if not required.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2777 e3e1d417-86f3-4887-817a-d78f3d33393f
2009-02-18 12:30:43 +00:00