Commit Graph

427 Commits

Author SHA1 Message Date
Isaac Connor
05e91f852d Use wallclock timestamps when doing audio as well 2024-08-20 15:21:29 -04:00
Isaac Connor
52d41fe3ce Sometimes the initial keyframe packet will have AV_NOPTS for pts and dts. When this happenes, set last_dts to -1 instead of 0, so that when the next packet comes in and sets the first_dts value, the resulting dts will be 0 which is > -1. 2024-08-02 13:24:39 -04:00
Isaac Connor
42b74d8ad4 Further separate wallclock timestamp logic from passthrough logic. Should fix negaitve timestamps 2024-07-29 10:17:59 -04:00
Isaac Connor
76226ca69c When using wallclock timestamps, redo the calc and set video_first_dts 2024-07-19 14:44:51 -04:00
Isaac Connor
0ee624933f Do not reorder packets if doing encoding as we use wallclock timestamps 2024-07-09 09:03:00 -04:00
Isaac Connor
ca770b9cd7 If WallClockTimetsamps is set, use the wallclock timestamp in the ZMPacket to override ptd, dts in the packet. Please note that it gets converted to in_stream->timebase and then to out_stream time_base. 2024-07-06 17:21:20 -04:00
Isaac Connor
1874c2b968 Add last_duration to warning about non increasing dts 2024-07-03 08:55:04 -04:00
Isaac Connor
9aea4aea9f Remove & from functions taking a shared_ptr 2024-06-28 14:33:34 -04:00
Isaac Connor
193a78264d Fix setting level by encoder params. Add setting gop size 2024-06-27 17:03:17 -04:00
Isaac Connor
6085782221 Handle setting h264 level in encoder params, instead of hard coding 32. 2024-06-27 16:01:47 -04:00
Isaac Connor
d8e15f19c2 Add options for h264_v4l2m2m encoder 2024-06-20 20:58:21 -04:00
Isaac Connor
f90150cf11 When dts==last_dts, don't log it as an error. It is too common. Just add duration and move on. 2024-06-10 19:11:03 -04:00
Isaac Connor
6e5f53fd27 Use last duration instead of 1 when adjusting dts when non-monotonic. Some googling indicates this might be a better approach. What I am seeing with a tapo C520WS agrees. 2024-06-07 12:10:51 -04:00
Isaac Connor
bf14b5f2a7 ENsure that dts increases. Not enough to just == last_dts 2024-04-27 10:07:14 -04: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
9eb3565483 Set reorder_queue size to 2*keyframe interval as 1* does not seem to be enough. 2024-03-15 12:11:22 -04:00
Isaac Connor
01ebcad29c Put back test for out of order packets. These buffers can take up a lot of ram even though they may not be needed. 2024-02-16 11:29:15 -05:00
Isaac Connor
63e57066c8 Always use a reorder_queue because an out of order packet may not have happened by the time we start recording, but may happen after. Reduce size to 1*keyframe interval as a test 2024-02-02 09:30:41 -05:00
Isaac Connor
c6ff1e9748 Fix cppcheck complaint 2024-01-29 13:44:02 -05:00
Isaac Connor
3f5328568e Spacing, mege some lines 2024-01-10 09:29:50 -05:00
Isaac Connor
6d0f634bfc Cleanup audio_in opening frmo setup_resampler, and open audio_in_ctx with the correct parameters 2024-01-03 18:50:53 -05:00
Isaac Connor
64a2007cec DOn't copy time_base to ctx, we aren't even using ctx. Fixes segafault beacuse audio_in_ctx is null. 2024-01-02 16:52:25 -05:00
Isaac Connor
b2ad4c8b40 Always allocate an audio_in_ctx instead of trying to use one opened elsewhere. SHould fix errors in resampling due to reusing an already open codec. 2024-01-02 16:24:27 -05:00
d-bum
c4a5413e47 Prevent allocation on already allocated context 2023-11-21 13:57:29 +01:00
Isaac Connor
e58781300d Handle ffmpeg6 deprecating (renaming) pkt_duration 2023-11-08 10:59:43 -05:00
Isaac Connor
ecec9cb29c Default to 2*keyframe interval for reorder_queue_size 2023-09-28 13:52:14 -04:00
Alejandro Criado-Pérez
543683aa4c Corrections on cpp and h files 2023-08-13 01:27:19 +02:00
Isaac Connor
d21d53eeb9 Remove reorder_queue_size when re-parsing opts to avoid warnings 2023-08-12 14:50:30 -04:00
Isaac Connor
f4d3b979f4 Implement automatic setting of redorder_queue_size in videostore by implementing has_out_of_order_packets and get_max_keyframe_interval in the monitor object. 2023-07-19 12:38:11 -04:00
Isaac Connor
24eecfeddb Put back support for ffmpeg < 5 2023-06-27 15:16:00 -04:00
iconnor
62789a83ab Implement more fixes for ffmpeg5 channel deprecations. 2023-06-27 13:20:19 -04:00
Isaac Connor
070b70c26b Handle ffmpeg5 channel deprecations 2023-06-19 10:57:13 -04:00
Isaac Connor
9a4376adcc Add reason for error setting up device 2023-02-26 16:31:32 -05:00
Isaac Connor
af6d2c6ca3 The sw pix format for qsv should be YUV420P 2023-02-26 11:00:50 -05:00
Isaac Connor
6505bba826 Add qsv codec options 2023-02-25 19:00:31 -05:00
Isaac Connor
95f9e0b19a Fix crash from getting packet from rend 2023-01-12 09:25:44 -05:00
Isaac Connor
65952705ac Fix logging of situation. I think inserting at rend, changes the value of rend. So reorder the lines a bit and include the dts of the packet we are inserting after 2022-12-24 12:33:41 -05:00
Isaac Connor
a1595c0093 Default to use faststart since we close events in a separate thread we can get away with this now 2022-10-12 19:15:04 -04:00
Isaac Connor
1cf0245aca Don't set AVFMT_TS_NONSTRICT. Crashes on ffmpeg 5. Fixes #3497 2022-08-12 18:21:58 -04:00
Isaac Connor
3034636501 Provide support for libaom-av1 2022-08-09 15:47:39 -04:00
Doug Nazar
f4dd897ef4 Convert AVFrame* to custom unique_ptr (av_frame_ptr).
Switch all owning AVFrame* variables to av_frame_ptr for
automatic cleanup.

Use AVBufferRef to store frame data in AVFrame where appropriate
so that it can be freed automatically with it's AVFrame.

Handle allocation errors.
2022-07-30 13:21:11 -04:00
Doug Nazar
acbdf1854d Add guard to handle resetting AVPacket after use.
Also handle allocation failures.
2022-07-29 14:56:38 -04:00
Doug Nazar
110cc436a3 Switch from av_init_packet() to av_packet_alloc()
Remove all uses of deprecated av_init_packet() and switch any stack
based AVPackets to unique_ptrs allocated with av_packet_alloc().

Ensure that all code paths call av_packet_unref() after use to reset
before next usage.
2022-07-29 14:56:26 -04:00
Isaac Connor
7f192c4e47 Merge pull request #3551 from dougnazar/fix_crash
Fix zmc Segfault on 1.36.20
2022-07-28 16:28:32 -04:00
Isaac Connor
f463246e43 Log reorder_queue_size 2022-07-28 15:46:01 -04:00
Isaac Connor
89277f8e67 Use encoder options to specify reorder_queue size used. Clean up repeated options parsing 2022-07-07 13:33:06 -04:00
Isaac Connor
0da5403a3c rework queuing to just have a depth of 10. Finish replacing AvPacket opkt with AVPacket *opkt 2022-06-17 10:34:59 -04:00
Isaac Connor
c2e91529ef make reorder_queues a map. Move it to writePacket. Update code for opkt.. 2022-06-16 18:29:23 -04:00
Isaac Connor
4e39de0e00 Merge branch 'master' into reorder_queue 2022-06-13 18:20:01 -04:00
Isaac Connor
95fe6e1e00 Don't coipy opkt.dts to pts as it will be done in write_packet 2022-05-30 09:53:32 -04:00