PR #23233 opened by James Almer (jamrial)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23233
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23233.patch

`out_layout` at this point is a zeroed struct, and even after being filled 
below in the code it's ensured it will be the same as `outlink->side_data`.

The actual check should be between inlink and outlink layouts. If they differ, 
then swr will do remixing and as such the downmix info side data will no longer 
be valid for any filter or encoder down the chain.


>From 9aadf9b00424f7ed8fd52d3ad00644240b07da61 Mon Sep 17 00:00:00 2001
From: James Almer <[email protected]>
Date: Mon, 25 May 2026 19:03:45 -0300
Subject: [PATCH] avfilter/af_aresample: fix layout comparison when applying
 downmix coeffs

out_layout at this point is a zeroed struct, and even after being filled below 
in the code
it's ensured it will be the same as outlink->side_data.
The actual check should be between inlink and outlink layouts. If they differ, 
then swr
will do remixing and as such the downmix info side data will no longer be valid 
for any
filter or encoder down the chain.

Signed-off-by: James Almer <[email protected]>
---
 libavfilter/af_aresample.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c
index 7c6f9141a7..6c8e8e96ce 100644
--- a/libavfilter/af_aresample.c
+++ b/libavfilter/af_aresample.c
@@ -177,7 +177,7 @@ static int config_output(AVFilterLink *outlink)
         av_opt_set_double(aresample->swr, "lfe_mix_level", di->lfe_mix_level, 
0);
         av_opt_set_int(aresample->swr, "matrix_encoding", matrix_encoding, 0);
 
-        if (av_channel_layout_compare(&outlink->ch_layout, &out_layout))
+        if (av_channel_layout_compare(&outlink->ch_layout, &inlink->ch_layout))
             av_frame_side_data_remove(&outlink->side_data, 
&outlink->nb_side_data,
                                       AV_FRAME_DATA_DOWNMIX_INFO);
     }
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to