pulse: clamp channel numbers to right values

When converting between pipewire and pulse channelmaps, make sure we
clamp the channel numbers to the the right limit.
This commit is contained in:
Wim Taymans 2025-04-04 15:13:47 +02:00
parent 722776cf65
commit a9f12537d1
4 changed files with 20 additions and 18 deletions

View file

@ -53,7 +53,7 @@ int volume_parse_param(const struct spa_pod *param, struct volume_info *info, bo
if (monitor)
continue;
info->volume.channels = spa_pod_copy_array(&prop->value, SPA_TYPE_Float,
info->volume.values, SPA_AUDIO_MAX_CHANNELS);
info->volume.values, CHANNELS_MAX);
SPA_FLAG_UPDATE(info->flags, VOLUME_HW_VOLUME,
prop->flags & SPA_POD_PROP_FLAG_HARDWARE);
break;
@ -68,7 +68,7 @@ int volume_parse_param(const struct spa_pod *param, struct volume_info *info, bo
if (!monitor)
continue;
info->volume.channels = spa_pod_copy_array(&prop->value, SPA_TYPE_Float,
info->volume.values, SPA_AUDIO_MAX_CHANNELS);
info->volume.values, CHANNELS_MAX);
SPA_FLAG_CLEAR(info->flags, VOLUME_HW_VOLUME);
break;
case SPA_PROP_volumeBase:
@ -84,7 +84,7 @@ int volume_parse_param(const struct spa_pod *param, struct volume_info *info, bo
}
case SPA_PROP_channelMap:
info->map.channels = spa_pod_copy_array(&prop->value, SPA_TYPE_Id,
info->map.map, SPA_AUDIO_MAX_CHANNELS);
info->map.map, CHANNELS_MAX);
break;
default:
break;