[FFmpeg-cvslog] avfilter/af_dcshift: add direct path

Paul B Mahol git at videolan.org
Wed Sep 6 12:50:46 EEST 2017


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Sep  6 11:46:24 2017 +0200| [eea69a9f250e565640f1dc69b285a4d27668f67b] | committer: Paul B Mahol

avfilter/af_dcshift: add direct path

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eea69a9f250e565640f1dc69b285a4d27668f67b
---

 libavfilter/af_dcshift.c | 16 +++++++++++-----
 1 file 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[] = {



More information about the ffmpeg-cvslog mailing list