[FFmpeg-devel] [PATCH] lavfi/tinterlace: check and propagate return values in case of errors

Stefano Sabatini stefasab at gmail.com
Tue Sep 4 23:20:49 CEST 2012


Add missing error checks for the functions ff_start_frame, ff_draw_slice,
ff_end_frame.
---
 libavfilter/vf_tinterlace.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c
index bb5cdc8..0254edb 100644
--- a/libavfilter/vf_tinterlace.c
+++ b/libavfilter/vf_tinterlace.c
@@ -219,7 +219,7 @@ static int end_frame(AVFilterLink *inlink)
     AVFilterBufferRef *cur  = tinterlace->cur;
     AVFilterBufferRef *next = tinterlace->next;
     AVFilterBufferRef *out  = NULL;
-    int field, tff;
+    int field, tff, ret;
 
     START_TIMER
     /* we need at least two frames */
@@ -300,9 +300,10 @@ static int end_frame(AVFilterLink *inlink)
         out = avfilter_ref_buffer(cur, ~AV_PERM_WRITE);
         out->video->interlaced = 1;
 
-        ff_start_frame(outlink, out);
-        ff_draw_slice(outlink, 0, outlink->h, 1);
-        ff_end_frame(outlink);
+        if ((ret = ff_start_frame(outlink, out)) < 0 ||
+            (ret = ff_draw_slice(outlink, 0, outlink->h, 1)) < 0 ||
+            (ret = ff_end_frame(outlink)) < 0)
+            return ret;
 
         /* output mix of current and next frame */
         tff = next->video->top_field_first;
@@ -325,9 +326,10 @@ static int end_frame(AVFilterLink *inlink)
 
     STOP_TIMER("tinterlace");
 
-    ff_start_frame(outlink, out);
-    ff_draw_slice(outlink, 0, outlink->h, 1);
-    ff_end_frame(outlink);
+    if ((ret = ff_start_frame(outlink, out)) < 0 ||
+        (ret = ff_draw_slice(outlink, 0, outlink->h, 1)) < 0 ||
+        (ret = ff_end_frame(outlink)) < 0)
+        return ret;
 
     tinterlace->frame++;
 
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list