[FFmpeg-devel] [PATCH] vsrc_buffer: add flags param to av_vsrc_buffer_add_video_buffer_ref

Stefano Sabatini stefano.sabatini-lala at poste.it
Fri Jun 3 19:19:50 CEST 2011


On date Friday 2011-06-03 13:26:53 +0200, Etienne Buira encoded:
> Hi Stefano, thank you very much for this patch!
> 
> On Fri, Jun 03, 2011 at 12:36:55PM +0200, Stefano Sabatini wrote:
> > The new flags parameter allow to specify if the video ref to add
> > should overwrite the cache, if the flag is not set vsrc_buffer will
> > complain and abort; otherwise it will clean the already cached video
> > ref before to overwrite it, thus avoiding a leak.
> > 
> > In particular, fix a massive leak occurring with ffmpeg -ss TIME -i
> > INPUT OUTPUT.
> 
> ffmpeg -i INPUT -ss TIME OUTPUT
> 
> > diff --git a/ffmpeg.c b/ffmpeg.c
> > index e5986a6..bbf8a41 100644
> > --- a/ffmpeg.c
> > +++ b/ffmpeg.c
> > @@ -1665,7 +1665,8 @@ static int output_packet(AVInputStream *ist, int ist_index,
> >                          picture.sample_aspect_ratio = ist->st->sample_aspect_ratio;
> >                      picture.pts = ist->pts;
> >  
> > -                    av_vsrc_buffer_add_frame(ost->input_video_filter, &picture);
> > +                    av_vsrc_buffer_add_frame(ost->input_video_filter,
> > +                                             &picture, AV_VSRC_BUF_FLAG_OVERWRITE);
> 
> About this part, wouldn't it better not to buffer frames that will be
> discarded anyway, by moving this #ifdef CONFIG_AVFILTER block at the
> beginning of if(start_time == 0[...])?

That's a fine idea, patch attached.

> Don't know all the pros and cons about modifying API, might be a good
> thing to add anyway.

Yes I think it may be useful, even if not necessary for this fix.
-- 
FFmpeg = Fast & Fiendish Mournful Portable Eretic Generator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ffmpeg-fix-massive-leak-when-seeking.patch
Type: text/x-diff
Size: 2275 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110603/30cc36f3/attachment.bin>


More information about the ffmpeg-devel mailing list