diff mbox

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

Message ID 20170405000300.25055-1-cus@passwd.hu
State Superseded
Headers show

Commit Message

Marton Balint April 5, 2017, 12:03 a.m. UTC
Fixes ticket #6285.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavfilter/vf_framerate.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Nicolas George April 6, 2017, 7:39 a.m. UTC | #1
Le sextidi 16 germinal, an CCXXV, Marton Balint a écrit :
> Fixes ticket #6285.
> 
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  libavfilter/vf_framerate.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

It respects the scheduling requirements, and the logic seems sound from
what I understand of framerate logic, so I guess it is ok.

Thanks for taking care of it.

Regards,
Moritz Barsnick April 6, 2017, 1:33 p.m. UTC | #2
On Wed, Apr 05, 2017 at 02:03:00 +0200, Marton Balint wrote:
> -static int process_work_frame(AVFilterContext *ctx, int stop)
> +static int process_work_frame(AVFilterContext *ctx, int filter_frame)

Just from a level of confusion, I don't find it smart to name a
variable (albeit a local one) the same as an existing function.

> +        return filter_frame ? 0 : ff_request_frame(ctx->inputs[0]);

The unknowing code reader (as myself) could interpret this as the check
for a function pointer. Only because I know functions of the name
filter_frame() are often used in filters. Yeah, silly me.

Just nitpicking a bit, perhaps quite irrelevant,
Moritz
diff mbox

Patch

diff --git a/libavfilter/vf_framerate.c b/libavfilter/vf_framerate.c
index b4a74f7..45fab25 100644
--- a/libavfilter/vf_framerate.c
+++ b/libavfilter/vf_framerate.c
@@ -341,7 +341,7 @@  static int blend_frames8(AVFilterContext *ctx, float interpolate,
     return 0;
 }
 
-static int process_work_frame(AVFilterContext *ctx, int stop)
+static int process_work_frame(AVFilterContext *ctx, int filter_frame)
 {
     FrameRateContext *s = ctx->priv;
     int64_t work_next_pts;
@@ -360,7 +360,7 @@  static int process_work_frame(AVFilterContext *ctx, int stop)
         // the filter cannot do anything
         ff_dlog(ctx, "process_work_frame() no current frame cached: move on to next frame, do not output a frame\n");
         next_source(ctx);
-        return 0;
+        return filter_frame ? 0 : ff_request_frame(ctx->inputs[0]);
     }
 
     work_next_pts = s->pts + s->average_dest_pts_delta;
@@ -384,7 +384,7 @@  static int process_work_frame(AVFilterContext *ctx, int stop)
         ff_dlog(ctx, "process_work_frame() work crnt pts >= srce next pts: SKIP FRAME, move on to next frame, do not output a frame\n");
         next_source(ctx);
         s->pending_srce_frames--;
-        return 0;
+        return filter_frame ? 0 : ff_request_frame(ctx->inputs[0]);
     }
 
     // calculate interpolation
@@ -436,7 +436,7 @@  copy_done:
     }
     ff_dlog(ctx, "process_work_frame() output a frame\n");
     s->dest_frame_num++;
-    if (stop)
+    if (filter_frame)
         s->pending_end_frame = 0;
     s->last_dest_frame_pts = s->work->pts;