[FFmpeg-devel] [PATCH] lavc/amfenc: Retain a reference to D3D frames used as input during the encoding process

Alexander Kravchenko akravchenko188 at gmail.com
Fri Apr 6 19:02:06 EEST 2018

> >> This breaks the testcase described in
> >> https://trac.ffmpeg.org/ticket/6990 which is basically the same as the
> >> one you described in this patch.
> >>
> >> I get the following spammed repeatedly:
> >>
> >> [AVHWFramesContext @ 000000000502d340] Static surface pool size exceeded.
> >> [mpeg2video @ 0000000002f8d400] get_buffer() failed
> >> [mpeg2video @ 0000000002f8d400] thread_get_buffer() failed
> >> [mpeg2video @ 0000000002f8d400] get_buffer() failed (-12 0000000000000000)
> >> Error while decoding stream #0:1: Operation not permitted
> >
> > Hi, could you please review the following updated patch
> > I added queue limit according initial pool size of incoming frame context.
> > This solves the problem running this pipeline without -extra_hw_frames 16 option, but -extra_hw_frames option can be used to
> have bigger queue for encoder.
> Yes, this solves it, and the output does indeed look good now. Thanks.
> I'll leave reviewing this patch to someone more familiar with hw encoding.
Thanks, James.

I think the following approaches could help to solve issues with pool size more flexible way
1) communication between decoder and the following frame consumer component (filter or encoder) about extra frames requirement in hw frame pool.
2) add function like av_buffer_pool_test(AVBufferPool *pool); which returns current status of pool (used/free frames count). 

More information about the ffmpeg-devel mailing list