pulse: only fixate when necessary

Check if the format is already fixated before doing a copy and fixate.
The copy can fail so we need to check this.
This commit is contained in:
Wim Taymans 2026-04-30 16:27:15 +02:00
parent b7aae374bf
commit dfc5fd86a7
2 changed files with 10 additions and 5 deletions

View file

@ -287,11 +287,17 @@ static void collect_device_info(struct pw_manager_object *device, struct pw_mana
switch (p->id) { switch (p->id) {
case SPA_PARAM_EnumFormat: case SPA_PARAM_EnumFormat:
{ {
struct spa_pod *copy = spa_pod_copy(p->param); struct spa_pod *to_free = NULL, *c = p->param;
spa_pod_fixate(copy); if (!spa_pod_is_fixated(c)) {
format_parse_param(copy, true, &dev_info->ss, &dev_info->map, to_free = spa_pod_copy(c);
if (to_free == NULL)
break;
spa_pod_fixate(to_free);
c = to_free;
}
format_parse_param(c, true, &dev_info->ss, &dev_info->map,
&defs->sample_spec, &defs->channel_map); &defs->sample_spec, &defs->channel_map);
free(copy); free(to_free);
break; break;
} }
case SPA_PARAM_Format: case SPA_PARAM_Format:

View file

@ -50,7 +50,6 @@ static void sample_play_ready_reply(void *data, struct client *client, uint32_t
message_put(reply, message_put(reply,
TAG_U32, index, TAG_U32, index,
TAG_INVALID); TAG_INVALID);
client_queue_message(client, reply); client_queue_message(client, reply);
ps->replied = true; ps->replied = true;
} }