[FFmpeg-devel] [RFC] How to fix DR+lavfi+vflip crash

Stefano Sabatini stefano.sabatini-lala
Thu Dec 23 01:37:00 CET 2010

On date Sunday 2010-12-19 20:43:16 +0100, Stefano Sabatini encoded:
> On date Saturday 2010-12-18 14:07:47 +0100, Michael Niedermayer encoded:
> > No, vflip flips the linesize.
> > This fliped buffer is passed on by start_frame to the next filter and if that
> > doesnt support it the existing code copies it
> > The previous filter is not affected by start_frame messing with line sizes,
> > It cant be affected because that would be a bug. A filter can have a static
> > buffer that it passes on and it can alraedy have rendered into this buffer
> > theres no way start_frame could tell the previous filter render fliped at that
> > time. Only though get_video_buffer() can teh previous filter be brought to
> > render upside down.
> > 
> > Thus if the previous filter uses get_video_buffer() it receives frames with
> > negative linesize (if supported) and start_frame then also receives these
> > buffers with negative linesize and it changes them to positive by fliping
> > linesize and vissual image
> > If OTOH the previous filter does not use get_video_buffer() or negative
> > linesizes arent supported somewhere along the path then start_frame gets
> > positive linesize frames and flips them to negative and (its the identical
> > operation as previous) if now a downstream filter cant handle negative linesizes
> > it gets copied before in that filters start_frame
> OK, this explanation was useful, thanks.
> Now I still can't find a way to avoid the copy in the filter, anyway
> the new approach is indeed much simpler.
> -- 
> FFmpeg = Foolish and Fast Marvellous Pure Elastic God

> From ee6dc086923ed994a5dd70ab79513d9a510c29ce Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> Date: Sun, 19 Dec 2010 16:35:50 +0100
> Subject: [PATCH] Introduce the AV_PERM_NEG_LINESIZES flag, which allows to explicitely
>  request a buffer which can have negative linesizes, so that if it is
>  not specified in the permissions for the requested buffer the returned
>  buffer must have positive linesizes.
> This is required in particular with direct rendering as implemented in
> ffplay, as some codec cannot process an image buffer with negative
> linesizes.
> Fix issue #1913.

FFmpeg = Foolish and Foolish Most Powered Elaborated Guru

More information about the ffmpeg-devel mailing list