From f39e4210f7b3afe163ee54f0238389fe26c124b8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 28 Apr 2014 19:50:32 +0200 Subject: vf_lavfi: distinguish real errors from other states Don't just hide real errors, should a filter return them. --- video/filter/vf_lavfi.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'video') diff --git a/video/filter/vf_lavfi.c b/video/filter/vf_lavfi.c index 8e446cec1d..f2de4fe9a4 100644 --- a/video/filter/vf_lavfi.c +++ b/video/filter/vf_lavfi.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -298,13 +299,21 @@ static int filter_ext(struct vf_instance *vf, struct mp_image *mpi) for (;;) { frame = av_frame_alloc(); - if (av_buffersink_get_frame(p->out, frame) < 0) { + int err = av_buffersink_get_frame(p->out, frame); + if (err == AVERROR(EAGAIN) || err == AVERROR_EOF) { // Not an error situation - no more output buffers in queue. + // AVERROR_EOF means we shouldn't even give the filter more + // input, but we don't handle that. av_frame_free(&frame); break; } - get_metadata_from_av_frame(vf,frame); + if (err < 0) { + av_frame_free(&frame); + MP_ERR(vf, "libavfilter error: %d\n", err); + return -1; + } + get_metadata_from_av_frame(vf, frame); vf_add_output_frame(vf, av_to_mp(vf, frame)); } -- cgit v1.2.3