[FFmpeg-devel] [PATCH] ffmpeg: handle the case when get_filtered_frame() fails

Stefano Sabatini stefano.sabatini-lala at poste.it
Mon May 23 19:57:36 CEST 2011


On date Friday 2011-05-20 09:11:40 +0200, Stefano Sabatini encoded:
> On date Friday 2011-05-20 02:38:26 +0200, Michael Niedermayer encoded:
> > On Fri, May 20, 2011 at 01:02:26AM +0200, Stefano Sabatini wrote:
> > > ---
> > >  ffmpeg.c |    3 ++-
> > >  1 files changed, 2 insertions(+), 1 deletions(-)
> > > 
> > > diff --git a/ffmpeg.c b/ffmpeg.c
> > > index fb644ad..b6ee7e3 100644
> > > --- a/ffmpeg.c
> > > +++ b/ffmpeg.c
> > > @@ -1690,7 +1690,8 @@ static int output_packet(AVInputStream *ist, int ist_index,
> > >                  while (frame_available) {
> > >                      AVRational ist_pts_tb;
> > >                      if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && ost->output_video_filter)
> > > -                        get_filtered_video_frame(ost->output_video_filter, &picture, &ost->picref, &ist_pts_tb);
> > > +                        if (get_filtered_video_frame(ost->output_video_filter, &picture, &ost->picref, &ist_pts_tb) < 0)
> > > +                            goto cont;
> > >                      if (ost->picref)
> > 
> > Can you elaborate when such failure happens ?
> > frame_available inplicates poll_frame() so request shouldnt fail i
> > think
> 
> Indeed this needs some explanation, as the failure I was experiencing
> comes from a pending select filter.
> 
> The filter works by selecting a frame according to an expression
> evaluated on the frame properties. poll() is propagated to the source,
> so we could have this situation:
> buffer tells that there is a frame, but when the frame is requested
> and is not selected request_frame() will fail. I tried other buffering
> methods but I concluded that this model was the cleaner/simpler.
>  
> I'm going to post the WIP select patch to make this more clear.
> 
> > the patch is probably ok but i dont understand whne this happens, maybe
> > a error message should be printed but then maybe not ....

Patch is no more required with the current select filter, but a check
on the return value of get_filtered_video_frame() is still useful imo,
and can't hurt.
-- 
FFmpeg = Fantastic Forgiving Minimalistic Patchable Eretic Gadget


More information about the ffmpeg-devel mailing list