diff options
author | Paul B Mahol <onemda@gmail.com> | 2017-09-06 12:46:24 +0300 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2017-09-06 12:46:24 +0300 |
commit | eea69a9f250e565640f1dc69b285a4d27668f67b (patch) | |
tree | fdc0a01ab426e72947a273ea52bb640b90ca7ed0 /libavfilter | |
parent | d8bc198d0979aa417469ddaac8c80146b1df9e4e (diff) |
avfilter/af_dcshift: add direct path
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/af_dcshift.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libavfilter/af_dcshift.c b/libavfilter/af_dcshift.c index 7332c12b19..2ca2d07535 100644 --- a/libavfilter/af_dcshift.c +++ b/libavfilter/af_dcshift.c @@ -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[] = { |