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

Stefano Sabatini stefasab at gmail.com
Wed Sep 5 23:38:50 CEST 2012


On date Wednesday 2012-09-05 18:15:29 +0200, Michael Niedermayer encoded:
> 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)

This is the usual way we deal with this situation.

Not that it matters, since we usually kill the filterchain, since that
usually means a fatal condition.
-- 
FFmpeg = Faithless Fascinating Magical Pitiful Extended Guru


More information about the ffmpeg-devel mailing list