mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
pulse-server: make sure we have a card_name
Clients crash if the card name is NULL so make sure we generate a backup name.
This commit is contained in:
parent
bddfc8c46e
commit
f9efc63a04
1 changed files with 11 additions and 2 deletions
|
|
@ -3529,10 +3529,11 @@ static int fill_card_info(struct client *client, struct message *m,
|
||||||
{
|
{
|
||||||
struct pw_manager *manager = client->manager;
|
struct pw_manager *manager = client->manager;
|
||||||
struct pw_device_info *info = o->info;
|
struct pw_device_info *info = o->info;
|
||||||
const char *str, *drv_name;
|
const char *str, *drv_name, *card_name;
|
||||||
uint32_t module_id = SPA_ID_INVALID, n_profiles, n;
|
uint32_t module_id = SPA_ID_INVALID, n_profiles, n;
|
||||||
struct card_info card_info = CARD_INFO_INIT;
|
struct card_info card_info = CARD_INFO_INIT;
|
||||||
struct profile_info *profile_info;
|
struct profile_info *profile_info;
|
||||||
|
char name[128];
|
||||||
|
|
||||||
if (!pw_manager_object_is_card(o) || info == NULL || info->props == NULL)
|
if (!pw_manager_object_is_card(o) || info == NULL || info->props == NULL)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -3544,9 +3545,17 @@ static int fill_card_info(struct client *client, struct message *m,
|
||||||
if (drv_name && spa_streq("bluez5", drv_name))
|
if (drv_name && spa_streq("bluez5", drv_name))
|
||||||
drv_name = "module-bluez5-device.c"; /* blueman needs this */
|
drv_name = "module-bluez5-device.c"; /* blueman needs this */
|
||||||
|
|
||||||
|
card_name = spa_dict_lookup(info->props, PW_KEY_DEVICE_NAME);
|
||||||
|
if (card_name == NULL)
|
||||||
|
card_name = spa_dict_lookup(info->props, "api.alsa.card.name");
|
||||||
|
if (card_name == NULL) {
|
||||||
|
snprintf(name, sizeof(name), "card_%u", o->index);
|
||||||
|
card_name = name;
|
||||||
|
}
|
||||||
|
|
||||||
message_put(m,
|
message_put(m,
|
||||||
TAG_U32, o->index, /* card index */
|
TAG_U32, o->index, /* card index */
|
||||||
TAG_STRING, spa_dict_lookup(info->props, PW_KEY_DEVICE_NAME),
|
TAG_STRING, card_name,
|
||||||
TAG_U32, id_to_index(manager, module_id),
|
TAG_U32, id_to_index(manager, module_id),
|
||||||
TAG_STRING, drv_name,
|
TAG_STRING, drv_name,
|
||||||
TAG_INVALID);
|
TAG_INVALID);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue