Isaac Connor
a903ab5d09
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-08 14:03:37 -04:00
Isaac Connor
dd99d9ff22
include memory to fix build on centos 7
2021-05-20 18:55:17 -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
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
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
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
9903e909af
Rework locking in ZMPacket by using a new class called ZMLockedPacket.
2021-03-15 17:05:30 -04: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 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
b40a31d76f
Move content of setMaxVideoPcakets into .cpp
2021-02-18 11:54:50 -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
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
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
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
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
f54b8fff44
use mutex and condition_variable to manage signalling. Lots of debugging and fixes
2020-12-09 15:01:24 -05:00
Isaac Connor
1257a7ea37
improvements reported by cppcheck
2020-11-01 16:11:19 -05:00
Isaac Connor
4ff341a0f5
Merge branch 'master' into zma_to_thread
2020-05-02 18:03:42 -04:00
Selva Nair
2e7fad68d1
Properly compute video buffer length when analysis fps is set
...
Currently the number of video frames kept in the buffer is set as the
pre_event_count. This falls short when the capture fps is larger
than the analysis fps. Fix by computing the retained video duration
as pre_event_count/analysis_fps
No change if analysis fps is not set.
Signed-off-by: Selva Nair <selva.nair@gmail.com>
2019-11-15 21:55:40 -05:00
Isaac Connor
396be10d6f
Merge branch 'master' into zma_to_thread
2019-08-22 12:57:00 -04:00
Isaac Connor
dd57fd95ce
Clean up cruft from videostore api. Fix packetqueue clear_unwanted_packets to take a pre_event_count and take it into consideration when finding the right spot in the queue to start recording.
2019-06-27 11:11:14 -04:00
Isaac Connor
dab9544845
Revert audio sync fixes ( #2646 )
...
* Reference /run/zm instead of /var/run/zm because systemd-tmpfiles complains about it
* Spacing, google code style and tabs to spaces
* Revert the work I did to srt packets by dts after changing their time_base. It doesn't work. Instead since dts doesn't actually matter to playback, only ffmpeg storing, munge it to whatever is neccessary to make ffmpeg happy.
2019-06-24 11:27:47 -04:00
Isaac Connor
470da03322
Merge sync fixes from storageareas
2019-06-20 15:14:20 -04:00
Isaac Connor
acb95709e6
Fix issues with too much audio in events by storing packets in the queue with their timestamps converted to AV_TIME_BASE_Q, so that we can sort video and audio packets together.
2019-06-11 10:19:42 -04:00
Isaac Connor
56d41e8f50
drop lock_packet
2019-02-26 09:45:51 -05:00
Isaac Connor
448294f593
wip
2019-02-25 10:21:43 -05:00
Isaac Connor
5ab1126260
Merge branch 'storageareas' into zma_to_thread
2018-10-20 17:31:14 -04:00
Isaac Connor
45a1a1b1e8
Make packetqueue keep track of audio vs video packet counts.
2018-10-15 10:51:56 -04:00
Isaac Connor
533b370a81
add a mutex to the packetqueue
2017-12-08 10:39:57 -05:00
APHW2 MFGENG
0cfc42b9fd
some cleanups/fixes
2017-12-05 13:16:52 -08:00
Isaac Connor
0865201e1e
seems to work
2017-12-01 07:26:34 -05:00
Isaac Connor
f2efc80f22
works?
2017-11-30 14:37:36 -05:00
Isaac Connor
8e494ef431
Merge branch 'storageareas' into zma_to_thread
2017-11-23 08:40:49 -05:00
Isaac Connor
24a0d717c5
wip
2017-11-21 19:55:40 -05:00
Isaac Connor
7ed495c948
wip
2017-11-21 11:58:15 -05:00
Isaac Connor
575b3138de
change it from a queue to a list. Implement a clearQueue that keeps some frames, and a function clear out unwanted frames
2017-04-12 13:39:47 -04:00
Isaac Connor
f19b3d5505
create zm_packet
2017-02-18 15:22:56 -05:00
Isaac Connor
19a60b01da
maybe fixes, maybe big memleaks
2016-09-20 16:59:43 -04:00
Isaac Connor
61df6e9d75
Work on aac encoding
2016-09-16 15:54:13 -04:00
Isaac Connor
caaaffbb5d
change sematics of pop to return the packet* instead of boolean. Free packets in clearQueue
2016-09-09 10:05:29 -04:00
Isaac Connor
a51944b2c5
cleanup, remove separate audio and video queues
2016-08-31 15:38:44 -04:00
Steve Gilvarry
0abfb7378a
Buffer work
2016-05-18 00:01:33 +10:00
Steve Gilvarry
1f3b3d1203
Revert "WIP packetqueue shared memory"
...
This reverts commit 8aa1cb6bf6
.
2016-05-08 15:25:18 +10:00
Steve Gilvarry
8aa1cb6bf6
WIP packetqueue shared memory
2016-05-03 20:07:45 +10:00
Steve Gilvarry
dcf3852124
Starting to convert to boost.interprocess
2016-04-28 01:28:37 +10:00
Steve Gilvarry
7fcd12fab9
Packetqueue tweaks, need to move this stuff up to monitor to maintain a packet buffer
2016-04-25 22:06:07 +10:00
SteveGilvarry
966fbb1a10
Add Packet Queue
2016-04-04 20:04:14 +10:00