avfilter/af_headphone: fix flushing

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2018-04-14 17:49:54 +02:00
parent 2b0f821f51
commit 01170e9db0
1 changed files with 14 additions and 1 deletions

View File

@ -742,7 +742,20 @@ static int request_frame(AVFilterLink *outlink)
s->eof_hrirs = 1;
}
}
return ff_request_frame(ctx->inputs[0]);
ret = ff_request_frame(ctx->inputs[0]);
if (ret == AVERROR_EOF && av_audio_fifo_size(s->in[0].fifo) > 0 && s->have_hrirs) {
AVFrame *in = ff_get_audio_buffer(outlink, s->size);
ret = av_audio_fifo_write(s->in[0].fifo, (void **)in->extended_data,
in->nb_samples);
if (ret < 0)
return ret;
ret = headphone_frame(s, outlink);
av_audio_fifo_drain(s->in[0].fifo, av_audio_fifo_size(s->in[0].fifo));
}
return ret;
}
static av_cold void uninit(AVFilterContext *ctx)