From e4f6fce9e0285778833179ae2c3b898231460e48 Mon Sep 17 00:00:00 2001
From: James Almer <jamrial@gmail.com>
Date: Fri, 25 Mar 2022 09:22:55 -0300
Subject: avutil/channel_layout: add missing check for AV_CHAN_NONE in
 av_channel_description

Prevents printing "user -1" on invalid channel ids.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavutil/channel_layout.c | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'libavutil')

diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c
index 2d4ccae1bf..c28b8928da 100644
--- a/libavutil/channel_layout.c
+++ b/libavutil/channel_layout.c
@@ -119,6 +119,8 @@ void av_channel_description_bprint(AVBPrint *bp, enum AVChannel channel_id)
     else if ((unsigned)channel_id < FF_ARRAY_ELEMS(channel_names) &&
              channel_names[channel_id].description)
         av_bprintf(bp, "%s", channel_names[channel_id].description);
+    else if (channel_id == AV_CHAN_NONE)
+        av_bprintf(bp, "none");
     else
         av_bprintf(bp, "user %d", channel_id);
 }
-- 
cgit v1.2.3