mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
media-session/pulse-server: more error checks + minor fixes
This commit is contained in:
parent
f330446291
commit
2681b8236b
10 changed files with 79 additions and 54 deletions
|
|
@ -908,6 +908,7 @@ static struct device *alsa_create_device(struct impl *impl, uint32_t id,
|
|||
if (impl->conn &&
|
||||
(card = spa_dict_lookup(info->props, SPA_KEY_API_ALSA_CARD)) != NULL) {
|
||||
const char *reserve;
|
||||
const char *path = spa_dict_lookup(info->props, SPA_KEY_API_ALSA_PATH);
|
||||
|
||||
device->priority -= atol(card) * 64;
|
||||
|
||||
|
|
@ -920,9 +921,10 @@ static struct device *alsa_create_device(struct impl *impl, uint32_t id,
|
|||
|
||||
if (device->reserve == NULL) {
|
||||
pw_log_warn("can't create device reserve for %s: %m", reserve);
|
||||
} else if (path) {
|
||||
rd_device_set_application_device_name(device->reserve, path);
|
||||
} else {
|
||||
rd_device_set_application_device_name(device->reserve,
|
||||
spa_dict_lookup(info->props, SPA_KEY_API_ALSA_PATH));
|
||||
pw_log_warn("empty reserve device path for %s", reserve);
|
||||
}
|
||||
}
|
||||
if (device->reserve != NULL)
|
||||
|
|
|
|||
|
|
@ -536,7 +536,7 @@ static int find_node(void *data, struct node *node)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(node->media, find->media) != 0) {
|
||||
if (node->media && strcmp(node->media, find->media) != 0) {
|
||||
pw_log_debug(".. incompatible media %s <-> %s", node->media, find->media);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,11 +158,13 @@ static char *serialize_props(struct stream *str, const struct spa_pod *param)
|
|||
SPA_POD_OBJECT_FOREACH(obj, prop) {
|
||||
switch (prop->key) {
|
||||
case SPA_PROP_volume:
|
||||
spa_pod_get_float(&prop->value, &val);
|
||||
if (spa_pod_get_float(&prop->value, &val) < 0)
|
||||
continue;
|
||||
fprintf(f, "%s\"volume\": %f", (comma ? ", " : ""), val);
|
||||
break;
|
||||
case SPA_PROP_mute:
|
||||
spa_pod_get_bool(&prop->value, &b);
|
||||
if (spa_pod_get_bool(&prop->value, &b) < 0)
|
||||
continue;
|
||||
fprintf(f, "%s\"mute\": %s", (comma ? ", " : ""), b ? "true" : "false");
|
||||
break;
|
||||
case SPA_PROP_channelVolumes:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue