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

Michael Niedermayer michaelni at gmx.at
Wed Sep 5 18:15:29 CEST 2012


On Tue, Sep 04, 2012 at 11:20:49PM +0200, Stefano Sabatini wrote:
> 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;

is it ok to start a frame but not to end it ? (when draw_slice fails)


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

What does censorship reveal? It reveals fear. -- Julian Assange
-------------- 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/20120905/39c8b67f/attachment.asc>


More information about the ffmpeg-devel mailing list