[Libav-user] Separating decoding and processing frames into threads
Nikita Vaňků
vanku.nikita at gmail.com
Mon Apr 24 16:38:34 EEST 2023
Hello everyone,
I'm experimenting with a decoding video stream on one thread and processing
those frames in the second thread.
In the decoding thread for each frame, I allocate a new AVFrame and after
receiving the decoded frames with avcodec_receive_frame I put them in a
mutexed queue, I do this in a loop and sleep if the queue is full.
The processing thread continuously grabs AVFrames from the mutexed queue,
processes them, and only sleeps if the queue is empty.
This works completely fine as long as I use software decoding, but if I
change the whole thing into any HW accelerated backend (doesn't matter if
its DXVA2 or VAAPI) and receive any HW frames it fails and constantly
prints various errors like this:
avcodec_send_packet: "Invalid data found when processing input"
[AVHWFramesContext @ 000001ca9afb9e80] Static surface pool size exceeded.
[h264 @ 000001ca9ae7d9c0] get_buffer() failed
[h264 @ 000001ca9ae7d9c0] thread_get_buffer() failed
[h264 @ 000001ca9ae7d9c0] decode_slice_header error
[h264 @ 000001ca9ae7d9c0] no frame!
Why is this happening? Is my approach even legal for this use? Did I miss
something in the documentation?
Thank you for your help,
Nikita
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20230424/38ef4df6/attachment.htm>
More information about the Libav-user
mailing list