[FFmpeg-devel] [PATCH] zerocodec: fix direct rendering.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Jul 21 21:16:15 CEST 2012

On Sat, Jul 21, 2012 at 12:54:26PM -0400, Derek Buitenhuis wrote:
> On 21/07/2012 7:24 AM, Reimar Döffinger wrote:
> > Set picture type before calling get_buffer.
> > This allows the DR application to make better decisions.
> > It also fixes a resource leak in case of missing reference frames
> > since it would call get_buffer but never release_buffer.
> > Also use FFSWAP to ensure that the AVFrame is properly initialized
> > in the next get_buffer (in particular that data[0] is NULL).
> > 
> > Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
> > ---
> >  libavcodec/zerocodec.c |   34 +++++++++++++++++-----------------
> >  1 file changed, 17 insertions(+), 17 deletions(-)
> This looks OK, but there is still a memleak if decode_frame fails.
> I've actually got a patch for that locally, and I'll rebase/send
> once this is pushed.

I guess those failure cases also open other questions:
Should the reference frame be freed and cleared on decode failure?
Because right now, after a decode failure all the following frames
will be silently decoded against a broken reference, which seems
at least not ideal.

More information about the ffmpeg-devel mailing list