[FFmpeg-cvslog] avfilter/vf_framerate: always request input if no output is provided in request_frame

Marton Balint git at videolan.org
Wed Apr 12 22:06:12 EEST 2017


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Wed Apr  5 01:41:15 2017 +0200| [51948b9d9e97e9065296db1d04885c1b45a1b250] | committer: Marton Balint

avfilter/vf_framerate: always request input if no output is provided in request_frame

Fixes ticket #6285.

Signed-off-by: Marton Balint <cus at passwd.hu>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=51948b9d9e97e9065296db1d04885c1b45a1b250
---

 libavfilter/vf_framerate.c | 42 ++++++++++++++++++++++++++----------------
 1 file changed, 26 insertions(+), 16 deletions(-)

diff --git a/libavfilter/vf_framerate.c b/libavfilter/vf_framerate.c
index b4a74f7f7d..dc8b05f40f 100644
--- a/libavfilter/vf_framerate.c
+++ b/libavfilter/vf_framerate.c
@@ -440,7 +440,7 @@ copy_done:
         s->pending_end_frame = 0;
     s->last_dest_frame_pts = s->work->pts;
 
-    return ff_filter_frame(ctx->outputs[0], s->work);
+    return 1;
 }
 
 static void set_srce_frame_dest_pts(AVFilterContext *ctx)
@@ -586,6 +586,7 @@ static int config_input(AVFilterLink *inlink)
 
 static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
 {
+    int ret;
     AVFilterContext *ctx = inlink->dst;
     FrameRateContext *s = ctx->priv;
 
@@ -606,7 +607,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
         set_srce_frame_dest_pts(ctx);
     }
 
-    return process_work_frame(ctx, 1);
+    ret = process_work_frame(ctx, 1);
+    if (ret < 0)
+        return ret;
+    return ret ? ff_filter_frame(ctx->outputs[0], s->work) : 0;
 }
 
 static int config_output(AVFilterLink *outlink)
@@ -658,23 +662,13 @@ static int request_frame(AVFilterLink *outlink)
 {
     AVFilterContext *ctx = outlink->src;
     FrameRateContext *s = ctx->priv;
-    int val, i;
+    int ret, i;
 
     ff_dlog(ctx, "request_frame()\n");
 
     // if there is no "next" frame AND we are not in flush then get one from our input filter
-    if (!s->srce[s->frst] && !s->flush) {
-        ff_dlog(ctx, "request_frame() call source's request_frame()\n");
-        val = ff_request_frame(outlink->src->inputs[0]);
-        if (val < 0 && (val != AVERROR_EOF)) {
-            ff_dlog(ctx, "request_frame() source's request_frame() returned error:%d\n", val);
-            return val;
-        } else if (val == AVERROR_EOF) {
-            s->flush = 1;
-        }
-        ff_dlog(ctx, "request_frame() source's request_frame() returned:%d\n", val);
-        return 0;
-    }
+    if (!s->srce[s->frst] && !s->flush)
+        goto request;
 
     ff_dlog(ctx, "request_frame() REPEAT or FLUSH\n");
 
@@ -695,7 +689,23 @@ static int request_frame(AVFilterLink *outlink)
     }
 
     set_work_frame_pts(ctx);
-    return process_work_frame(ctx, 0);
+    ret = process_work_frame(ctx, 0);
+    if (ret < 0)
+        return ret;
+    if (ret)
+        return ff_filter_frame(ctx->outputs[0], s->work);
+
+request:
+    ff_dlog(ctx, "request_frame() call source's request_frame()\n");
+    ret = ff_request_frame(ctx->inputs[0]);
+    if (ret < 0 && (ret != AVERROR_EOF)) {
+        ff_dlog(ctx, "request_frame() source's request_frame() returned error:%d\n", ret);
+        return ret;
+    } else if (ret == AVERROR_EOF) {
+        s->flush = 1;
+    }
+    ff_dlog(ctx, "request_frame() source's request_frame() returned:%d\n", ret);
+    return 0;
 }
 
 static const AVFilterPad framerate_inputs[] = {



More information about the ffmpeg-cvslog mailing list