diff mbox series

[FFmpeg-devel,03/22] lavc/encoder: always print an error on an unsupported channel layout

Message ID 20230707094847.25324-3-anton@khirnov.net
State Accepted
Commit fc6c746aa17fd4434cf81f045c4644ded02b0912
Headers show
Series [FFmpeg-devel,01/22] lavc/encode: print separate messages for unknown and unsupported formats | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov July 7, 2023, 9:48 a.m. UTC
Even if the layout is indescribable.
---
 libavcodec/encode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 0d44f70ee9..ba91dcc31e 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -675,8 +675,8 @@  static int encode_preinit_audio(AVCodecContext *avctx)
         if (!c->ch_layouts[i].nb_channels) {
             char buf[512];
             int ret = av_channel_layout_describe(&avctx->ch_layout, buf, sizeof(buf));
-            if (ret > 0)
-                av_log(avctx, AV_LOG_ERROR, "Specified channel layout '%s' is not supported\n", buf);
+            av_log(avctx, AV_LOG_ERROR, "Specified channel layout '%s' is not supported\n",
+                   ret > 0 ? buf : "?");
             return AVERROR(EINVAL);
         }
     }