Commit Graph

113 Commits

Author SHA1 Message Date
Isaac Connor
a1364a2b2b delete packet_lock if failed trylock 2021-03-30 16:14:42 -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
e51fe9eb4a add tail_count to encode option 2021-03-22 21:31:09 -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
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
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
6a2e237902 Fix delete packet before deleting lock on packet 2021-03-17 10:07:03 -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
b238a2bc25 Implement decoder thread, locking is broken 2021-03-15 15:08:43 -04:00
Isaac Connor
786adc5511 Spacing 2021-03-11 13:48:52 -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
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
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 Isaac
f2143fd092 Improve debug logs 2021-02-23 13:12:09 -05:00
Isaac Connor
507cbf7f0f Remove some debugging 2021-02-19 15:56:42 -05:00
Isaac Connor
415dd83d06 spacing 2021-02-19 12:44:24 -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
127e15ba3a Don't crash if we ask for packet count of an invalid stream 2021-02-18 13:47:27 -05:00
Isaac Connor
b40a31d76f Move content of setMaxVideoPcakets into .cpp 2021-02-18 11:54:50 -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
01e69569eb Placement of -- matters. 2021-02-08 09:04:06 -05:00
Peter Keresztes Schmidt
938676b129 ffmpeg: exit dumpPacket early if debug logging is not enabled 2021-02-07 11:58:17 +01: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
8de260472d improve the logic of clearing packets from queue. make get_event_start_it return a pointer to an it tracked by the packetqueue. 2021-02-02 23:19:52 -05:00
Isaac Connor
b71aa4bd97 Fix never allowing the queue to fill when pre_event_count=0 2021-02-01 16:01:30 -05:00
Isaac Connor
aa53260a32 Free packet counts and iterators in destructor. Fix mem leak in queuePacket. Introduce free_it method to release iterators 2021-02-01 10:25:48 -05:00
Isaac Connor
dd57d05f40 Convert packetqueue from a pointer to a packetqueue to a member packetqueue that is always available. Add methods to set packetqueue parameters. Emptying the queue is now in packetqueue::clear() 2021-01-31 21:31:33 -05:00
Isaac Connor
0fb7cb935f Fix skipping over the head packet when deleting packets. 2021-01-31 11:42:51 -05:00
Isaac Connor
5fc52ae6df Handle iterator pointing to end 2021-01-30 20:34:09 -05:00
Isaac Connor
be893fe9e4 Since we loop in here, need to lock the packetqueue 2021-01-27 11:48:32 -05:00
Isaac Connor
e73e6aaabc check for terminating before locking packetqueue. Handle when pre_event_count==0 2021-01-26 12:23:44 -05:00
Isaac Connor
a0df09dcaa Have to check for lock on video keyframe as well 2021-01-25 12:07:56 -05:00
Isaac Connor
66c78e5a9b Merge branch 'zma_to_thread' into rtsp_server 2021-01-19 13:43:25 -05:00
Isaac Connor
b1b72ec85b Improve debugging. Add parenthesis to fix test for end. I think the * dereference is not being applied at the right time. 2021-01-19 09:46:08 -05:00
Isaac Connor
f44f920bf2 spacing 2021-01-14 10:31:29 -05:00
Isaac Connor
3423d8ed05 Only delete packets up to the next video keyframe. Don't be too aggressive 2021-01-12 14:13:12 -05:00
Isaac Connor
e706b4ba33 Hitting beginning of queue can happen on stream startup. So in that case make it a debug. Once the stream has been going for a while there should always be enough packets in the queue so make it a warning 2021-01-11 17:18:14 -05:00
Isaac Connor
ebe3a9b6a7 Must notify before waiting in destructor. Fix leaks 2021-01-11 13:46:50 -05:00
Isaac Connor
514e0d2e93 remove analysis_it and correctly manage external iterators. Fix testing for ability to remove packets from packetqueue. Fix some cases where the order of testing zm_terminate and packet locking is important 2021-01-11 13:46:50 -05:00
Isaac Connor
c70e2ccfc2 Must notify before waiting in destructor. Fix leaks 2021-01-07 15:12:44 -05:00
Isaac Connor
abc402878b remove analysis_it and correctly manage external iterators. Fix testing for ability to remove packets from packetqueue. Fix some cases where the order of testing zm_terminate and packet locking is important 2021-01-07 09:43:53 -05:00
Isaac Connor
284b9f963f Merge branch 'master' into zma_to_thread 2020-12-29 12:18:26 -05:00
Isaac Connor
9be7547c8b Look at stream index instead of image_index when finding first keyframe in packetqueue 2020-12-27 12:32:46 -05:00
Isaac Connor
16662f79ce spacing and code stylez 2020-12-27 12:03:44 -05:00
Isaac Connor
a1917d83d0 Merge branch 'master' into zma_to_thread 2020-12-22 19:52:09 -05:00
Isaac Connor
91057b9546 Clean up video_packet_count stuff. use packet_counts instead. Use more efficient logic for managing the # of video packets on the queue. Rewrite clearQueue to not use reverse iterators. Implement get_starting_packet to return an iterator to the packet that SHOULD start an event. So it takes into account pre_event_count and keyframe rules. 2020-12-22 10:20:44 -05:00
Isaac Connor
a502a86b00 Instead of pointing analsysis_it to begin, point it to the end, which is the newly pushed packet. Add back queue clearing 2020-12-15 16:01:18 -05:00