[FFmpeg-cvslog] avfilter/af_afade: Remove impossible branch

Andreas Rheinhardt git at videolan.org
Sat Oct 2 17:59:23 EEST 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Mon Sep 27 03:55:43 2021 +0200| [1f387ae4cb49070b3594086abd59027f07b4a773] | committer: Andreas Rheinhardt

avfilter/af_afade: Remove impossible branch

Also don't call ff_inlink_queued_samples() unnecessarily often.

Fixes Coverity issue 1427665.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavfilter/af_afade.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c
index 3bd0331e77..aecbb44f70 100644
--- a/libavfilter/af_afade.c
+++ b/libavfilter/af_afade.c
@@ -483,20 +483,18 @@ static int activate(AVFilterContext *ctx)
         }
     }
 
-    if (ff_inlink_queued_samples(ctx->inputs[0]) > s->nb_samples) {
-        nb_samples = ff_inlink_queued_samples(ctx->inputs[0]) - s->nb_samples;
-        if (nb_samples > 0) {
-            ret = ff_inlink_consume_samples(ctx->inputs[0], nb_samples, nb_samples, &in);
-            if (ret < 0) {
-                return ret;
-            }
-        }
+    nb_samples = ff_inlink_queued_samples(ctx->inputs[0]);
+    if (nb_samples  > s->nb_samples) {
+        nb_samples -= s->nb_samples;
+        ret = ff_inlink_consume_samples(ctx->inputs[0], nb_samples, nb_samples, &in);
+        if (ret < 0)
+            return ret;
         in->pts = s->pts;
         s->pts += av_rescale_q(in->nb_samples,
             (AVRational){ 1, outlink->sample_rate }, outlink->time_base);
         return ff_filter_frame(outlink, in);
-    } else if (ff_inlink_queued_samples(ctx->inputs[0]) >= s->nb_samples &&
-               ff_inlink_queued_samples(ctx->inputs[1]) >= s->nb_samples && s->cf0_eof) {
+    } else if (s->cf0_eof && nb_samples >= s->nb_samples &&
+               ff_inlink_queued_samples(ctx->inputs[1]) >= s->nb_samples) {
         if (s->overlap) {
             out = ff_get_audio_buffer(outlink, s->nb_samples);
             if (!out)



More information about the ffmpeg-cvslog mailing list