[FFmpeg-devel] [PATCHv6 4/4] libavcodec: v4l2: add support for v4l2 mem2mem codecs
nfxjfg at googlemail.com
Mon Aug 28 22:53:56 EEST 2017
On Mon, 28 Aug 2017 21:24:26 +0200
Jorge Ramirez <jorge.ramirez-ortiz at linaro.org> wrote:
> On 08/28/2017 02:16 PM, Jorge Ramirez wrote:
> > On 08/28/2017 12:47 PM, wm4 wrote:
> >>> I guess that instead of polling for the AVBufferRef to be unreferenced,
> >>> I can associate a sync (ie a sempahore) to each buffer, take it on
> >>> release and post the semaphore on the AVBufferRefs being unreferenced.
> >>> that is actually pretty clean in terms of cpu usage.
> >> That would just freeze an API user calling avcodec_close(), when it
> >> keeps around decoded AVFrames for later use.
> > yes I understand, but it does avoid using the CPU to poll for the
> > buffer release (an incremental improvement)
> > but yes I think that the message is that even though this proposal
> > might suffice for simple video players (my tests) is not good enough
> > for other users requiring the decoded frame for post processing.
> > is this a blocker to upstream or could I continue working with it
> > flagging the encoder/decoder as EXPERIMENTAL? the current situation at
> > least keeps video players happy.
I'd say yes this is a blocker. We usually try to avoid committing
half-finished code, because it often means it will be never finished.
> just wondering, if the AVBufferRefs must live for ever (ie, after the
> codecs have been closed), what do other codecs dequeuing from a limited
> number of re-usable hardware allocated buffers do?
> do they use the CPU allocate and copy the data from those buffers to the
Like I wrote before: hwaccels use AVHWFramesContext, which was made
more or less for this situation. If you want FD support later (for
something like zero-copy transcoding or playback), AVHWFramesContext
will probably be mandatory anyway. But I guess it's a big change for
someone not familiar with the codebase.
But manually "nesting" AVBufferRefs to make any underlying state
refcounted would also work.
More information about the ffmpeg-devel