[FFmpeg-devel] [PATCH] vf_overlay: clear cur_buf only in end_frame.
Michael Niedermayer
michaelni at gmx.at
Fri Jul 27 05:04:57 CEST 2012
On Thu, Jul 26, 2012 at 07:09:16PM +0200, Nicolas George wrote:
> Fix a segfault when a copy is needed.
>
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
> libavfilter/vf_overlay.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
> index 05e9e1b..58a059d 100644
> --- a/libavfilter/vf_overlay.c
> +++ b/libavfilter/vf_overlay.c
> @@ -513,11 +513,8 @@ static int start_frame_main(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
> flush_frames(ctx);
> inpicref->pts = av_rescale_q(inpicref->pts, ctx->inputs[MAIN]->time_base,
> ctx->outputs[0]->time_base);
> - if (try_start_frame(ctx, inpicref) < 0) {
> + if (try_start_frame(ctx, inpicref) < 0)
> ff_bufqueue_add(ctx, &over->queue_main, inpicref);
> - av_assert1(inpicref == inlink->cur_buf);
> - inlink->cur_buf = NULL;
> - }
> return 0;
> }
>
> @@ -546,8 +543,10 @@ static int end_frame_main(AVFilterLink *inlink)
> AVFilterBufferRef *outpicref = outlink->out_buf;
> flush_frames(ctx);
>
> - if (!outpicref)
> + if (!outpicref) {
> + inlink->cur_buf = NULL;
> return 0;
> + }
> return ff_end_frame(ctx->outputs[0]);
this looks fragile, implicating from the value of out_buf if
cur_buf has been copied
it might make more sense to create a new reference so the original
can saftely be freed or add a seperate flag that indicates if cur_buf
has to be set to NULL before returning
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- 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/20120727/929d3926/attachment.asc>
More information about the ffmpeg-devel
mailing list