---
Local testing revealed the following fixes to be needed.

If nobody has any objections, i'll squash this into the original patch and push
tomorrow
---
 libavfilter/af_bs2b.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavfilter/af_bs2b.c b/libavfilter/af_bs2b.c
index bda70b6..25e7867 100644
--- a/libavfilter/af_bs2b.c
+++ b/libavfilter/af_bs2b.c
@@ -85,6 +85,14 @@ static av_cold int init(AVFilterContext *ctx)
     return 0;
 }
 
+static av_cold void uninit(AVFilterContext *ctx)
+{
+    Bs2bContext *bs2b = ctx->priv;
+
+    if (bs2b->bs2bp)
+        bs2b_close(bs2b->bs2bp);
+}
+
 static int query_formats(AVFilterContext *ctx)
 {
     AVFilterFormats *formats = NULL;
@@ -99,7 +107,7 @@ static int query_formats(AVFilterContext *ctx)
         AV_SAMPLE_FMT_NONE,
     };
 
-    if (ff_add_channel_layout(&layouts, av_get_default_channel_layout(2)) != 0)
+    if (ff_add_channel_layout(&layouts, AV_CH_LAYOUT_STEREO) != 0)
         return AVERROR(ENOMEM);
     ff_set_common_channel_layouts(ctx, layouts);
 
@@ -130,6 +138,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
         out_frame = ff_get_audio_buffer(inlink, frame->nb_samples);
         if (!out_frame)
             return AVERROR(ENOMEM);
+        av_frame_copy(out_frame, frame);
         ret = av_frame_copy_props(out_frame, frame);
         if (ret < 0) {
             av_frame_free(&out_frame);
@@ -207,6 +216,7 @@ AVFilter ff_af_bs2b = {
     .priv_size      = sizeof(Bs2bContext),
     .priv_class     = &bs2b_class,
     .init           = init,
+    .uninit         = uninit,
     .inputs         = bs2b_inputs,
     .outputs        = bs2b_outputs,
 };
-- 
1.7.10.4

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to