[FFmpeg-cvslog] avfilter/vf_decimate: always properly handle EOF

Paul B Mahol git at videolan.org
Sun Dec 27 23:25:03 EET 2020


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Dec 27 22:22:40 2020 +0100| [f1357274e912b40928ed4dc100b4c1de8750508b] | committer: Paul B Mahol

avfilter/vf_decimate: always properly handle EOF

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

 libavfilter/vf_decimate.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_decimate.c b/libavfilter/vf_decimate.c
index 32a4cdc535..73d9ba8928 100644
--- a/libavfilter/vf_decimate.c
+++ b/libavfilter/vf_decimate.c
@@ -267,20 +267,25 @@ static int activate(AVFilterContext *ctx)
     }
     if (ret < 0) {
         return ret;
-    } else if (dm->eof == ((1 << INPUT_MAIN) | ((dm->ppsrc << INPUT_CLEANSRC) * dm->ppsrc))) {
+    } else if (dm->eof == ((1 << INPUT_MAIN) | (dm->ppsrc << INPUT_CLEANSRC))) {
         ff_outlink_set_status(ctx->outputs[0], AVERROR_EOF, dm->last_pts);
         return 0;
     } else if (!(dm->eof & (1 << INPUT_MAIN)) && ff_inlink_acknowledge_status(ctx->inputs[INPUT_MAIN], &status, &pts)) {
         if (status == AVERROR_EOF) { // flushing
             dm->eof |= 1 << INPUT_MAIN;
-            if (!dm->ppsrc)
-                return filter_frame(ctx->inputs[INPUT_MAIN], NULL);
+            if (dm->ppsrc)
+                filter_frame(ctx->inputs[INPUT_CLEANSRC], NULL);
+            filter_frame(ctx->inputs[INPUT_MAIN], NULL);
+            ff_outlink_set_status(ctx->outputs[0], AVERROR_EOF, dm->last_pts);
+            return 0;
         }
     } else if (dm->ppsrc && !(dm->eof & (1 << INPUT_CLEANSRC)) && ff_inlink_acknowledge_status(ctx->inputs[INPUT_CLEANSRC], &status, &pts)) {
         if (status == AVERROR_EOF) { // flushing
             dm->eof |= 1 << INPUT_CLEANSRC;
             filter_frame(ctx->inputs[INPUT_MAIN], NULL);
-            return filter_frame(ctx->inputs[INPUT_CLEANSRC], NULL);
+            filter_frame(ctx->inputs[INPUT_CLEANSRC], NULL);
+            ff_outlink_set_status(ctx->outputs[0], AVERROR_EOF, dm->last_pts);
+            return 0;
         }
     }
 



More information about the ffmpeg-cvslog mailing list