1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00

avfilter/af_afir: add missing error check

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2017-11-20 13:25:39 +01:00
parent 200f497997
commit d1b284119b

View File

@ -267,11 +267,13 @@ static int read_ir(AVFilterLink *link, AVFrame *frame)
{ {
AVFilterContext *ctx = link->dst; AVFilterContext *ctx = link->dst;
AudioFIRContext *s = ctx->priv; 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, ret = av_audio_fifo_write(s->fifo[1], (void **)frame->extended_data,
frame->nb_samples); frame->nb_samples);
av_frame_free(&frame); av_frame_free(&frame);
if (ret < 0)
return ret;
nb_taps = av_audio_fifo_size(s->fifo[1]); nb_taps = av_audio_fifo_size(s->fifo[1]);
max_nb_taps = MAX_IR_DURATION * ctx->outputs[0]->sample_rate; 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; AVFilterContext *ctx = link->dst;
AudioFIRContext *s = ctx->priv; AudioFIRContext *s = ctx->priv;
AVFilterLink *outlink = ctx->outputs[0]; AVFilterLink *outlink = ctx->outputs[0];
int ret = 0; int ret;
av_audio_fifo_write(s->fifo[0], (void **)frame->extended_data, ret = av_audio_fifo_write(s->fifo[0], (void **)frame->extended_data,
frame->nb_samples); frame->nb_samples);
if (s->pts == AV_NOPTS_VALUE) if (ret > 0 && s->pts == AV_NOPTS_VALUE)
s->pts = frame->pts; s->pts = frame->pts;
av_frame_free(&frame); av_frame_free(&frame);
if (ret < 0)
return ret;
if (!s->have_coeffs && s->eof_coeffs) { if (!s->have_coeffs && s->eof_coeffs) {
ret = convert_coeffs(ctx); ret = convert_coeffs(ctx);
if (ret < 0) 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) { while (av_audio_fifo_size(s->fifo[0]) >= s->part_size) {
ret = fir_frame(s, outlink); ret = fir_frame(s, outlink);
if (ret < 0) if (ret < 0)
break; return ret;
} }
} }
return ret; return 0;
} }
static int request_frame(AVFilterLink *outlink) static int request_frame(AVFilterLink *outlink)
@ -334,9 +339,11 @@ static int request_frame(AVFilterLink *outlink)
if (!silence) if (!silence)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
av_audio_fifo_write(s->fifo[0], (void **)silence->extended_data, ret = av_audio_fifo_write(s->fifo[0], (void **)silence->extended_data,
silence->nb_samples); silence->nb_samples);
av_frame_free(&silence); av_frame_free(&silence);
if (ret < 0)
return ret;
s->need_padding = 0; s->need_padding = 0;
} }