[FFmpeg-devel] [PATCH 3/5] ffmpeg: flush and drain video filters.

Stefano Sabatini stefasab at gmail.com
Fri Mar 9 20:02:33 CET 2012


On date Thursday 2012-03-08 14:49:16 +0100, Nicolas George encoded:
> When EOF is reached on the input stream, ffmpeg must
> ensure that the graph input returns EOF instead of EAGAIN
> and request frames once more until exhaustion.
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  ffmpeg.c |   38 ++++++++++++++++++++++++++++----------
>  1 files changed, 28 insertions(+), 10 deletions(-)
[...]
>  #if CONFIG_AVFILTER
> -        while (av_buffersink_poll_frame(ost->output_video_filter)) {
> +        while (1) {
>              AVRational ist_pts_tb = ost->output_video_filter->inputs[0]->time_base;
>              AVFrame *filtered_frame;
>  
> -            if (av_buffersink_get_buffer_ref(ost->output_video_filter, &ost->picref, 0) < 0){
> -                av_log(NULL, AV_LOG_WARNING, "AV Filter told us it has a frame available but failed to output one\n");
> -                goto cont;
> +            ret = av_buffersink_get_buffer_ref(ost->output_video_filter, &ost->picref, 0);
> +            if (ret < 0){
> +                if (ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) {
> +                    char errbuf[128];
> +                    av_strerror(ret, errbuf, sizeof(errbuf));
> +                    av_log(NULL, AV_LOG_WARNING,
> +                           "Error filtering video frame: %s\n", errbuf);
> +                } else {
> +                    ret = 0;
> +                }
> +                break;

Can you comment on this? Why is the poll API not enough in this case?

[...]
-- 
FFmpeg = Fierce and Fantastic Monstrous Programmable Exciting Ghost


More information about the ffmpeg-devel mailing list