spa: avoid using SPA_AUDIO_MAX_CHANNELS

Use SPA_N_ELEMENTS instead of the array we try to handle.
This commit is contained in:
Wim Taymans 2025-10-21 16:05:33 +02:00
parent 818d1435ce
commit dbc5c81e4a
7 changed files with 22 additions and 16 deletions

View file

@ -2046,7 +2046,7 @@ static int do_auto_port_config(struct impl *this, const char *str)
return -ENOENT;
if (format.media_subtype == SPA_MEDIA_SUBTYPE_raw) {
uint32_t n_pos = SPA_MIN(SPA_AUDIO_MAX_CHANNELS, format.info.raw.channels);
uint32_t n_pos = SPA_MIN(SPA_N_ELEMENTS(format.info.raw.position), format.info.raw.channels);
if (position == POSITION_AUX) {
for (i = 0; i < n_pos; i++)
format.info.raw.position[i] = SPA_AUDIO_CHANNEL_START_Aux + i;