[FFmpeg-devel] [PATCH] vf_overlay: clear cur_buf only in end_frame.

Nicolas George nicolas.george at normalesup.org
Thu Jul 26 19:09:16 CEST 2012


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]);
 }
 
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list