avfilter/af_dcshift: add direct path

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2017-09-06 11:46:24 +02:00
parent d8bc198d09
commit eea69a9f25
1 changed files with 11 additions and 5 deletions

View File

@ -90,11 +90,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
int i, j;
double dcshift = s->dcshift;
if (!out) {
av_frame_free(&in);
return AVERROR(ENOMEM);
if (av_frame_is_writable(in)) {
out = in;
} else {
out = ff_get_audio_buffer(inlink, in->nb_samples);
if (!out) {
av_frame_free(&in);
return AVERROR(ENOMEM);
}
av_frame_copy_props(out, in);
}
av_frame_copy_props(out, in);
if (s->limitergain > 0) {
for (i = 0; i < inlink->channels; i++) {
@ -134,7 +139,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
}
}
av_frame_free(&in);
if (out != in)
av_frame_free(&in);
return ff_filter_frame(outlink, out);
}
static const AVFilterPad dcshift_inputs[] = {