[FFmpeg-devel] [PATCH] libavcodec/utils: Simplify get_buffer compatibility wrapper.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Feb 17 00:19:46 CET 2014

On Mon, Feb 17, 2014 at 12:13:39AM +0100, wm4 wrote:
> On Mon, 17 Feb 2014 00:04:47 +0100
> Reimar Döffinger <Reimar.Doeffinger at gmx.de> wrote:
> > I don't think this is legal. In a user-allocated buffer there is nothing
> > guaranteeing that any of this area is valid to use (it might be just
> > a window inside a framebuffer, the allocated area is the whole
> > framebuffer but touching anything outside the lines will destroy the
> > framebuffer content), and the API does not require that all memory
> > in the buffers is ok to access.
> I think it does. The author of the reference counting API added this
> code himself (see commit 7e350379f87e). Basically, giving out a
> reference to some memory means you give access to all that memory.

Why not just extend the API to actually be convenient.
In terms of practical effect: if av_frame_get_plane_buffer returns
NULL all bets are off and you can't do any fancy optimizations.
That would avoid the af_join and vf_pad issues, and I _think_
it shouldn't be much code (less than the code we can remove in utils.c -
at least for vf_pad, and with better compatibility).

More information about the ffmpeg-devel mailing list