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

Michael Niedermayer michaelni at gmx.at
Sun Jun 5 18:57:39 CEST 2011


On Sun, Jun 05, 2011 at 06:17:04PM +0200, Stefano Sabatini wrote:
> On date Sunday 2011-06-05 00:50:12 +0200, Michael Niedermayer encoded:
> > On Fri, Jun 03, 2011 at 07:19:50PM +0200, Stefano Sabatini wrote:
> [...]
> > >  ffmpeg.c |   22 +++++++---------------
> > >  1 file changed, 7 insertions(+), 15 deletions(-)
> > > 7c2b7d6adc4e181b775dfaf02efedc39a1d374bf  0001-ffmpeg-fix-massive-leak-when-seeking.patch
> > > From 36e7f6a33d96a437b9dc39e297b25e721c3d6c1d Mon Sep 17 00:00:00 2001
> > > From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> > > Date: Fri, 3 Jun 2011 19:03:44 +0200
> > > Subject: [PATCH] ffmpeg: fix massive leak when seeking
> > > 
> > > Avoid to add frames to the vsrc_buffer in case ist->pts < start_time,
> > > as these frames are unused (and never released). In particular this
> > > condition is verified with commands of the kind:
> > > ffmpeg -i INPUT -ss TIME OUTPUT
> > > 
> > > Also simplify.
> > 
> > LGTM if tested
> 
> Applied. In attachment the subject patch, which is imo still useful.
> -- 
> FFmpeg = Frenzy and Furious Mysterious Portentous Earthshaking Geisha

>  ffmpeg.c                  |    3 ++-
>  libavfilter/avcodec.h     |    5 ++++-
>  libavfilter/vsrc_buffer.c |   22 ++++++++++++++--------
>  libavfilter/vsrc_buffer.h |   11 ++++++++++-
>  4 files changed, 30 insertions(+), 11 deletions(-)
> 80534bd5c4d4e80024658ba18803cd81de8add95  0001-vsrc_buffer-add-flags-param-to-av_vsrc_buffer_add_vi.patch
> From fe30483eb9804cdaecdfbc2b60ec58666ac7bb0d Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> Date: Thu, 2 Jun 2011 15:43:21 +0200
> Subject: [PATCH] vsrc_buffer: add flags param to av_vsrc_buffer_add_video_buffer_ref
> 
> 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.
> ---
>  ffmpeg.c                  |    3 ++-
>  libavfilter/avcodec.h     |    5 ++++-
>  libavfilter/vsrc_buffer.c |   22 ++++++++++++++--------
>  libavfilter/vsrc_buffer.h |   11 ++++++++++-
>  4 files changed, 30 insertions(+), 11 deletions(-)
> 
> diff --git a/ffmpeg.c b/ffmpeg.c
> index fb619e7..b18224b 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -1691,7 +1691,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);
>                  }
>                  frame_available = ist->st->codec->codec_type != AVMEDIA_TYPE_VIDEO ||
>                      !ost->output_video_filter || avfilter_poll_frame(ost->output_video_filter->inputs[0]);

iam not sure about this hunk
the rest is ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110605/92a80a0e/attachment.asc>


More information about the ffmpeg-devel mailing list