[FFmpeg-cvslog] avfilter/buffersrc: fix overriding unknown channel layouts with negotiated one

Marton Balint git at videolan.org
Sat Mar 30 23:25:33 EET 2024


ffmpeg | branch: release/5.1 | Marton Balint <cus at passwd.hu> | Sat Mar 23 16:10:22 2024 +0100| [defa085fc88d018d398b00ccefbe386659864694] | committer: Marton Balint

avfilter/buffersrc: fix overriding unknown channel layouts with negotiated one

Fixes ffplay playback of unknown layouts, when SDL directly supports the audio
format, such as:

ffplay -f lavfi anullsrc=cl=2C,aformat=s16

Without the patch, "Channel layout change is not supported" errors are
generated because buffersrc (unknown 2 channel) and buffersink (stereo)
negotiated a stereo layout, but the stereo layout was never stored in the
BufferSourceContext.

This fixes a regression of 7251f909721a570726775acf61b2b9c28a950c76, but this
is more of a regression of the avfilter channel layout conversion
(1f96db959c1235bb7079d354e09914a0a2608f62).

Signed-off-by: Marton Balint <cus at passwd.hu>
(cherry picked from commit 2df2b4067ed01b9076a5dda073521551a32336cd)

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

 libavfilter/buffersrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index a3190468bb..4949605d30 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -450,7 +450,7 @@ static int config_props(AVFilterLink *link)
         }
         break;
     case AVMEDIA_TYPE_AUDIO:
-        if (!c->ch_layout.nb_channels) {
+        if (!c->ch_layout.nb_channels || c->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) {
             int ret = av_channel_layout_copy(&c->ch_layout, &link->ch_layout);
             if (ret < 0)
                 return ret;



More information about the ffmpeg-cvslog mailing list