diff options
author | Paul B Mahol <onemda@gmail.com> | 2017-11-20 15:37:24 +0300 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2017-11-20 15:54:04 +0300 |
commit | 4073046089f59cb6d5d46a2a2ab28f8a59b0f428 (patch) | |
tree | 83178fae9093f246ac05a376bb7f2916555cc90f /libavfilter | |
parent | d1b284119bd5c6a52124443de2c45dbe569c25fc (diff) |
avfilter/af_headphone: add missing error check
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/af_headphone.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c index 3b76d1d737..2188f7ab24 100644 --- a/libavfilter/af_headphone.c +++ b/libavfilter/af_headphone.c @@ -324,16 +324,19 @@ static int read_ir(AVFilterLink *inlink, AVFrame *frame) { AVFilterContext *ctx = inlink->dst; HeadphoneContext *s = ctx->priv; - int ir_len, max_ir_len, input_number; + int ir_len, max_ir_len, input_number, ret; for (input_number = 0; input_number < s->nb_inputs; input_number++) if (inlink == ctx->inputs[input_number]) break; - av_audio_fifo_write(s->in[input_number].fifo, (void **)frame->extended_data, - frame->nb_samples); + ret = av_audio_fifo_write(s->in[input_number].fifo, (void **)frame->extended_data, + frame->nb_samples); av_frame_free(&frame); + if (ret < 0) + return ret; + ir_len = av_audio_fifo_size(s->in[input_number].fifo); max_ir_len = 65536; if (ir_len > max_ir_len) { @@ -572,13 +575,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) AVFilterLink *outlink = ctx->outputs[0]; int ret = 0; - av_audio_fifo_write(s->in[0].fifo, (void **)in->extended_data, - in->nb_samples); + ret = av_audio_fifo_write(s->in[0].fifo, (void **)in->extended_data, + in->nb_samples); if (s->pts == AV_NOPTS_VALUE) s->pts = in->pts; av_frame_free(&in); + if (ret < 0) + return ret; + if (!s->have_hrirs && s->eof_hrirs) { ret = convert_coeffs(ctx, inlink); if (ret < 0) @@ -589,10 +595,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) while (av_audio_fifo_size(s->in[0].fifo) >= s->size) { ret = headphone_frame(s, outlink); if (ret < 0) - break; + return ret; } } - return ret; + + return 0; } static int query_formats(AVFilterContext *ctx) |