[FFmpeg-cvslog] avfilter/af_afir: add missing error check

Paul B Mahol git at videolan.org
Mon Nov 20 14:54:53 EET 2017


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Nov 20 13:25:39 2017 +0100| [d1b284119bd5c6a52124443de2c45dbe569c25fc] | committer: Paul B Mahol

avfilter/af_afir: add missing error check

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

 libavfilter/af_afir.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c
index c4443fdffd..c81a1e22cf 100644
--- a/libavfilter/af_afir.c
+++ b/libavfilter/af_afir.c
@@ -267,11 +267,13 @@ static int read_ir(AVFilterLink *link, AVFrame *frame)
 {
     AVFilterContext *ctx = link->dst;
     AudioFIRContext *s = ctx->priv;
-    int nb_taps, max_nb_taps;
+    int nb_taps, max_nb_taps, ret;
 
-    av_audio_fifo_write(s->fifo[1], (void **)frame->extended_data,
-                        frame->nb_samples);
+    ret = av_audio_fifo_write(s->fifo[1], (void **)frame->extended_data,
+                             frame->nb_samples);
     av_frame_free(&frame);
+    if (ret < 0)
+        return ret;
 
     nb_taps = av_audio_fifo_size(s->fifo[1]);
     max_nb_taps = MAX_IR_DURATION * ctx->outputs[0]->sample_rate;
@@ -288,15 +290,18 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
     AVFilterContext *ctx = link->dst;
     AudioFIRContext *s = ctx->priv;
     AVFilterLink *outlink = ctx->outputs[0];
-    int ret = 0;
+    int ret;
 
-    av_audio_fifo_write(s->fifo[0], (void **)frame->extended_data,
-                        frame->nb_samples);
-    if (s->pts == AV_NOPTS_VALUE)
+    ret = av_audio_fifo_write(s->fifo[0], (void **)frame->extended_data,
+                              frame->nb_samples);
+    if (ret > 0 && s->pts == AV_NOPTS_VALUE)
         s->pts = frame->pts;
 
     av_frame_free(&frame);
 
+    if (ret < 0)
+        return ret;
+
     if (!s->have_coeffs && s->eof_coeffs) {
         ret = convert_coeffs(ctx);
         if (ret < 0)
@@ -307,10 +312,10 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
         while (av_audio_fifo_size(s->fifo[0]) >= s->part_size) {
             ret = fir_frame(s, outlink);
             if (ret < 0)
-                break;
+                return ret;
         }
     }
-    return ret;
+    return 0;
 }
 
 static int request_frame(AVFilterLink *outlink)
@@ -334,9 +339,11 @@ static int request_frame(AVFilterLink *outlink)
 
             if (!silence)
                 return AVERROR(ENOMEM);
-            av_audio_fifo_write(s->fifo[0], (void **)silence->extended_data,
-                        silence->nb_samples);
+            ret = av_audio_fifo_write(s->fifo[0], (void **)silence->extended_data,
+                                      silence->nb_samples);
             av_frame_free(&silence);
+            if (ret < 0)
+                return ret;
             s->need_padding = 0;
         }
 



More information about the ffmpeg-cvslog mailing list