[Libav-user] Separating decoding and processing frames into threads

Nicolas George george at nsup.org
Mon Apr 24 18:36:18 EEST 2023


Nikita Vaňků (12023-04-24):
>		 I do this in a loop and sleep if the queue is full.

>		  and only sleeps if the queue is empty.

I hope “sleep” here is a simplification for “pthread_cond_wait”.

> 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?

Hardware frames often resize in the memory of the device or its driver.
Therefore, only a limited number of them can exist at a time. It seems
your queue is too large for that. You probably need to copy the frame at
least once.

Or maybe you had a memory leak and you have not noticed in with software
frames because your memory is huge.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20230424/a7d23a73/attachment.sig>


More information about the Libav-user mailing list