Commit Graph
160 Commits
Author SHA1 Message Date
Isaac Connor 9935e4011c Remove check for pktQueue.size(). We know that there are packets in it 2022-04-28 16:43:31 -04:00
Isaac Connor a80a8532f9 Use notify_all instead of notify_one. If the analysis thread wakes up first, can then wait on packet and decoder won't wake up until next capture 2022-04-28 16:41:51 -04:00
Isaac Connor dbe8981378 Reduce warnings by setting has_warned = false in the correct spot. Add code comments 2022-04-28 10:36:06 -04:00
Isaac Connor 6c17bc36bc Add check for deleting or terminating. Decrement packet counts in clear so that debugging makes more sense 2022-04-28 10:36:06 -04:00
Isaac Connor 55efd859c3 If deleting don't bother queuing 2022-04-07 13:11:56 -04:00
Isaac Connor 034dda5b6c Only bump iterators if we are pushing onto the back of the queue. If we are re-ordering, can do nothing about the iterators. Show if iterator points to the packet in dumpQueue. 2022-04-04 16:27:43 -04:00
Isaac Connor 5a78a765d1 Add in re-ordering of packets based on dts. 2022-04-03 16:24:21 -04:00
Isaac Connor bdffa10cc6 limit logging of full packetqueue 2022-03-27 13:14:40 -04:00
Isaac Connor 2768975f96 Only notify one. Anyone waiting is waiting on a lock and only 1 process can get that lock, so only one should try. 2022-02-08 10:12:29 -05:00
Isaac Connor 8c13aa7d3a Cleanup LockedPacket, use RAII 2022-02-08 10:10:00 -05:00
Isaac Connor 8e689340ce Don't need to check for end of queue as we already did that when adding packet to the queue 2022-02-08 10:06:32 -05:00
Isaac Connor fe01af6966 Don't need to test for end() because we added our packet to the queue and still have the lock 2022-02-08 09:57:56 -05:00
Isaac Connor 4be9c6cdd2 Code comments and make warning when the first packet in queue is locked. 2021-11-24 12:42:31 -05:00
Isaac Connor 9d37fbcd8e Fix some build warnings on arm 2021-11-12 15:11:48 -05:00
Isaac Connor e1d49ea172 fix index -> image_index 2021-10-17 15:13:34 -04:00
Isaac Connor 3f6d6fe7a0 Improve debug logging of packetqueue cleaning 2021-10-17 15:02:31 -04:00
Isaac Connor 086bf7a84f introduce new logic that keeps the initial keyframe and deletes 1 video frame after it to keep the count down. Also any audio frames it encounters. 2021-10-14 12:47:51 -04:00
Isaac Connor 411d15605a We can lockup if MaxImageBufferCount is less than keyframe interval. Give up after 10 tries and drop the packet 2021-10-14 10:08:51 -04:00
Isaac Connor 74ac79479f notifying before waiting serves no purpose because we have the lock 2021-10-13 15:02:07 -04:00
Isaac Connor c6cac57fb1 remove bogus wanring 2021-10-12 12:45:06 -04:00
Isaac Connor 0ba3d863a6 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2021-10-12 12:25:01 -04:00
Isaac Connor aca477e737 Add warning when MaxImageBufferCount is less than keyframe interval 2021-09-28 10:30:51 -04:00
Isaac Connor d2cf89565e wait won't wake up other threads, so notify first. Since we have the lock, this should be ok 2021-09-15 12:53:41 -04:00
Isaac Connor bf5c0a8617 More properly fix the threading lock. Instead of waiting on a packet, release it and wait on the packetqueue. 2021-09-14 16:21:32 -04:00
Isaac Connor e6b67dcdc2 We cannot delete from the queue when capturing. Just do the waiting. Reduce severity of logs. Make more use of auto. Realise that no other iterators can be pointing into the queue. 2021-06-15 13:42:55 -04:00
Isaac Connor fa11c20bf8 Merge pull request #3297 from Carbenium/time-misc
Convert the rest of the codebase to std::chrono
2021-06-13 17:47:40 -04:00
Peter Keresztes Schmidt f675afc3f2 zmc: Convert internals to std::chrono 2021-06-13 23:22:51 +02:00
Isaac Connor 9f8c8a2664 Return early if packetqueue is empty instead of getting the lock. Return early in clear() if we are not initialised 2021-06-13 14:08:51 -04:00
Isaac Connor b16eb510d0 More debugging around clearQueue. return early if deleting 2021-06-04 15:03:08 -04:00
Isaac Connor fc6202d349 Introduce get_packet_and_increase_it just so we can lose an extra grab lock and function calls, etc. In queuePacket, if the queue is full, WAIT instead of failing to queue. 2021-06-03 18:22:18 -04:00
Isaac Connor 70946921bc fix code to release lock before notifying 2021-05-13 08:54:55 -04:00
Isaac Connor 76171fcc43 If not doing passthrough, don't need to find the nearest keyframe 2021-05-11 10:22:40 -04:00
Isaac Connor 3cd9bdccd5 style and performance improvements reported by cppcheck 2021-05-09 16:39:38 -04:00
Isaac Connor 2cf6ad8089 Switch ZMPacket * to a shared_ptr<ZMPacket>. This is so that in LockedPacket we can unlock and then notify and be confident that packet_ won't have been deleted. Change ZMPacket->timestamp to be a timeval instead of timeval *. This might not have been necessary but I like it. No longer cuse the ZMPacket object to wrap the shared image buffers and timestamps. Use a vector for image_buffers. 2021-05-08 21:14:20 -04:00
Isaac Connor 4685c63fab Add early return if pktQueue is empty so we can assume that it isn't below. Add notifications if we wake up and find that we have terminated so as to wake up any other waiters. Fixes failure to terminate when deinterlacing because both decoder and analysis are waiting 2021-05-07 14:04:51 -04:00
Isaac Connor 43f2f195f1 Fix a case in get_event_start_packet_it where if no pre_event_count we log an error and maybe don't start on a keyframe 2021-05-07 09:10:26 -04:00
Peter Keresztes Schmidt 68bedfe48f Fix logging format string mismatches
* Remove SZFMTD format macro and use %zu instead for size_t. %zu is understood by every compiler nowadays.
2021-04-30 00:26:24 +02:00
Isaac Connor a9ca6f8c13 Check for packets in the queue before we start traversing it to prevent crash 2021-04-28 12:12:24 -04:00
Isaac Connor 408e0963a0 Improve code and logging 2021-04-20 23:06:17 -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 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 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 cb7e365e35 Add locking increment_it. I think we need it. 2021-04-06 13:55:09 -04:00
Isaac Connor 8aceccd496 improve the message when max video packets is exceeded 2021-04-01 11:53:57 -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 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 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