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

Michael Niedermayer michaelni
Wed Dec 15 13:22:24 CET 2010


On Tue, Dec 14, 2010 at 11:17:47PM +0100, Stefano Sabatini wrote:
> On date Saturday 2010-12-11 20:31:02 +0100, Michael Niedermayer encoded:
> > On Sat, Dec 11, 2010 at 06:15:36PM +0100, Stefano Sabatini wrote:
> > > On date Saturday 2010-12-11 14:49:54 +0100, Michael Niedermayer encoded:
> [...]
> > > > in avfilter_start_frame()
> > > > the linesize case can be added here:
> > > >  /* prepare to copy the picture if it has insufficient permissions */
> > > >     if ((dst->min_perms & picref->perms) != dst->min_perms ||
> > > >          dst->rej_perms & picref->perms) {
> > > 
> > > how is this related? Also this will allow to save not more than 3
> > > lines in the code (while making the core code more obscure).
> > 
> > Its related in the way that if a filter does not support negative linesizes
> > it will not receive frames with negative linesizes but rather a copy with
> > positive linesizes.
> 
> A filter gets a frame from the filterchain through *_get_buffer, but

a frame can be allocated by other means too like a buffer from sdl or static
memory from the inside of a video decoder


> at this stage the received buffer doesn't contain any meaningful data,
> so the obtained frame can't be a copy of anything.

the actual copying happens in avfilter_draw_slice() before passing the call on
to the next filter


>  
> > > > in vflips
> > > > get_video_buffer()
> > > > check if negative linesizes are permitted and if not return a buffer from
> > > > default allocation or just skip the buffer flip
> > > 
> > > this is already implemented
> > > 
> > > The problem is how to integrate it with draw_slice()/end_frame(), and
> > > support both the cases where the frame has to be inverted and not.
> > 
> > sorry, i dont understand, if the code is working no changes should be required
> > in draw_slice() or end_frame() unless iam missing something
> > 
> > the linesize for input of draw_slice and end_frame of vflip
> > is a mere cosmetic detail
> > x + y*linesize is valid either way
> > 
> > so what kind of problem do you see?
> 
> Have another look at my last patch. You see that most code is in the
> vflip draw_slice() function. Now avfilter_draw_slice() has similar
> code which copies the input slice to the output slice when this is
> required for permission reasons.
> 
> Now we could try to move the vflipping code to
> avfilter_draw_slice(). Now this is a problem because this way
> avfilter_draw_slice() has to know *when* to vflip the frame, which is
> not required when the code is in the vflip filter.

the permission code in start_frame needs 1 line to be added for the current
copying code in draw_slice to copy the frame.

i dont understand the rest of your convoluted ideas.

1. We need copying code if buffer permissions differ, this exists and i assume
   it works, if it doesnt work it needs to be fixed
2. We need to copy if we have a negative linesize and a filter not supporting
   it
i see nothing in your mails which would even hint on why the permission copy
could not handle the case where linesizes differ

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101215/337743cd/attachment.pgp>



More information about the ffmpeg-devel mailing list