aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/af_afir.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2017-11-20 13:25:39 +0100
committerPaul B Mahol <onemda@gmail.com>2017-11-20 13:54:04 +0100
commitd1b284119bd5c6a52124443de2c45dbe569c25fc (patch)
treeb2182762d1866147c6af1a039559545dc97dfeee /libavfilter/af_afir.c
parent200f497997a123066f18eafe0c706516da2f1d4c (diff)
downloadffmpeg-d1b284119bd5c6a52124443de2c45dbe569c25fc.tar.gz
avfilter/af_afir: add missing error check
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter/af_afir.c')
-rw-r--r--libavfilter/af_afir.c29
1 files 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;
}