[FFmpeg-devel] [PATCH] vsrc_buffer: add flags param to av_vsrc_buffer_add_video_buffer_ref
etienne.buira.lists at free.fr
Fri Jun 3 13:26:53 CEST 2011
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[...])?
Don't know all the pros and cons about modifying API, might be a good
thing to add anyway.
More information about the ffmpeg-devel