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>
This commit is contained in:
James Almer 2022-03-25 09:22:55 -03:00
parent b04f14136e
commit e4f6fce9e0

View File

@ -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);
}