[FFmpeg-cvslog] avfilter/af_compand: simplify frame allocation

Paul B Mahol git at videolan.org
Wed Feb 8 19:58:15 EET 2023


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Feb  8 18:54:16 2023 +0100| [7e1d474021898251dd4b3e56c0d153eafd440f7c] | committer: Paul B Mahol

avfilter/af_compand: simplify frame allocation

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

 libavfilter/af_compand.c | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/libavfilter/af_compand.c b/libavfilter/af_compand.c
index ba90d21ced..3e799c3b15 100644
--- a/libavfilter/af_compand.c
+++ b/libavfilter/af_compand.c
@@ -306,8 +306,6 @@ static int config_output(AVFilterLink *outlink)
     int nb_attacks, nb_decays, nb_points;
     int new_nb_items, num;
     int i;
-    int err;
-
 
     count_items(s->attacks, &nb_attacks);
     count_items(s->decays, &nb_decays);
@@ -495,25 +493,9 @@ static int config_output(AVFilterLink *outlink)
         return 0;
     }
 
-    s->delay_frame = av_frame_alloc();
-    if (!s->delay_frame) {
-        uninit(ctx);
+    s->delay_frame = ff_get_audio_buffer(outlink, s->delay_samples);
+    if (!s->delay_frame)
         return AVERROR(ENOMEM);
-    }
-
-    s->delay_frame->format         = outlink->format;
-    s->delay_frame->nb_samples     = s->delay_samples;
-#if FF_API_OLD_CHANNEL_LAYOUT
-FF_DISABLE_DEPRECATION_WARNINGS
-    s->delay_frame->channel_layout = outlink->channel_layout;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-    if ((err = av_channel_layout_copy(&s->delay_frame->ch_layout, &outlink->ch_layout)) < 0)
-        return err;
-
-    err = av_frame_get_buffer(s->delay_frame, 0);
-    if (err)
-        return err;
 
     s->compand = compand_delay;
     return 0;



More information about the ffmpeg-cvslog mailing list