treewide: remove some obsolete channel checks

The spa_audio_info can not be parsed with too many channels so there
is always enough space for the positions.
This commit is contained in:
Wim Taymans 2025-10-24 10:28:38 +02:00
parent 78219471ff
commit aa0272f6f3
8 changed files with 50 additions and 64 deletions

View file

@ -43,7 +43,7 @@ spa_format_audio_raw_ext_parse(const struct spa_pod *format, struct spa_audio_in
SPA_FORMAT_AUDIO_channels, SPA_POD_OPT_Int(&info->channels),
SPA_FORMAT_AUDIO_position, SPA_POD_OPT_Pod(&position));
if (info->channels > max_position)
return -ENOTSUP;
return -ECHRNG;
if (position == NULL ||
spa_pod_copy_array(position, SPA_TYPE_Id, info->position, max_position) != info->channels)
SPA_FLAG_SET(info->flags, SPA_AUDIO_FLAG_UNPOSITIONED);
@ -78,6 +78,8 @@ spa_format_audio_raw_ext_build(struct spa_pod_builder *builder, uint32_t id,
if (info->channels != 0) {
spa_pod_builder_add(builder,
SPA_FORMAT_AUDIO_channels, SPA_POD_Int(info->channels), 0);
/* we drop the positions here when we can't read all of them. This is
* really a malformed spa_audio_info structure. */
if (!SPA_FLAG_IS_SET(info->flags, SPA_AUDIO_FLAG_UNPOSITIONED) &&
max_position > info->channels) {
spa_pod_builder_add(builder, SPA_FORMAT_AUDIO_position,