mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
policy-node: do downmix in monitor streams
Monitor streams usually have 1 channel so ask for all monitored channels to be downmixed. Don't try to configure video or unknown streams
This commit is contained in:
parent
cb91e9c536
commit
9e8851e0ae
1 changed files with 18 additions and 11 deletions
|
|
@ -95,6 +95,7 @@ struct node {
|
||||||
unsigned int enabled:1;
|
unsigned int enabled:1;
|
||||||
unsigned int configured:1;
|
unsigned int configured:1;
|
||||||
unsigned int dont_remix:1;
|
unsigned int dont_remix:1;
|
||||||
|
unsigned int monitor:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool find_format(struct node *node)
|
static bool find_format(struct node *node)
|
||||||
|
|
@ -140,10 +141,8 @@ static int configure_node(struct node *node, struct spa_audio_info *info)
|
||||||
if (node->configured)
|
if (node->configured)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (info == NULL) {
|
if (info != NULL) {
|
||||||
if (!find_format(node))
|
if (info->info.raw.channels < node->format.info.raw.channels || node->monitor)
|
||||||
return -EINVAL;
|
|
||||||
} else {
|
|
||||||
node->format = *info;
|
node->format = *info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -178,6 +177,10 @@ static void object_update(void *data)
|
||||||
|
|
||||||
if (node->obj->obj.avail & SM_NODE_CHANGE_MASK_PARAMS &&
|
if (node->obj->obj.avail & SM_NODE_CHANGE_MASK_PARAMS &&
|
||||||
!node->active) {
|
!node->active) {
|
||||||
|
if (!find_format(node)) {
|
||||||
|
pw_log_debug(NAME" %p: can't find format %p", impl, node);
|
||||||
|
return;
|
||||||
|
}
|
||||||
node->active = true;
|
node->active = true;
|
||||||
sm_media_session_schedule_rescan(impl->session);
|
sm_media_session_schedule_rescan(impl->session);
|
||||||
}
|
}
|
||||||
|
|
@ -218,7 +221,7 @@ handle_node(struct impl *impl, struct sm_object *object)
|
||||||
spa_list_append(&impl->node_list, &node->link);
|
spa_list_append(&impl->node_list, &node->link);
|
||||||
|
|
||||||
if (role && !strcmp(role, "DSP"))
|
if (role && !strcmp(role, "DSP"))
|
||||||
node->active = true;
|
node->active = node->configured = true;
|
||||||
|
|
||||||
if (strstr(media_class, "Stream/") == media_class) {
|
if (strstr(media_class, "Stream/") == media_class) {
|
||||||
media_class += strlen("Stream/");
|
media_class += strlen("Stream/");
|
||||||
|
|
@ -241,10 +244,10 @@ handle_node(struct impl *impl, struct sm_object *object)
|
||||||
else
|
else
|
||||||
node->plugged = SPA_TIMESPEC_TO_NSEC(&impl->now);
|
node->plugged = SPA_TIMESPEC_TO_NSEC(&impl->now);
|
||||||
}
|
}
|
||||||
node->active = true;
|
node->active = node->configured = true;
|
||||||
}
|
}
|
||||||
else if (strstr(media_class, "Unknown") == media_class) {
|
else if (strstr(media_class, "Unknown") == media_class) {
|
||||||
node->active = true;
|
node->active = node->configured = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
node->direction = direction;
|
node->direction = direction;
|
||||||
|
|
@ -261,7 +264,7 @@ handle_node(struct impl *impl, struct sm_object *object)
|
||||||
else if (strstr(media_class, "Video/") == media_class) {
|
else if (strstr(media_class, "Video/") == media_class) {
|
||||||
media_class += strlen("Video/");
|
media_class += strlen("Video/");
|
||||||
media = "Video";
|
media = "Video";
|
||||||
node->active = true;
|
node->active = node->configured = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -528,14 +531,18 @@ static int rescan_node(struct impl *impl, struct node *n)
|
||||||
info = n->obj->info;
|
info = n->obj->info;
|
||||||
props = info->props;
|
props = info->props;
|
||||||
|
|
||||||
|
if ((str = spa_dict_lookup(props, PW_KEY_STREAM_DONT_REMIX)) != NULL)
|
||||||
|
n->dont_remix = pw_properties_parse_bool(str);
|
||||||
|
|
||||||
|
if ((str = spa_dict_lookup(props, PW_KEY_STREAM_MONITOR)) != NULL)
|
||||||
|
n->monitor = pw_properties_parse_bool(str);
|
||||||
|
|
||||||
str = spa_dict_lookup(props, PW_KEY_NODE_AUTOCONNECT);
|
str = spa_dict_lookup(props, PW_KEY_NODE_AUTOCONNECT);
|
||||||
if (str == NULL || !pw_properties_parse_bool(str)) {
|
if (str == NULL || !pw_properties_parse_bool(str)) {
|
||||||
pw_log_debug(NAME" %p: node %d does not need autoconnect", impl, n->id);
|
pw_log_debug(NAME" %p: node %d does not need autoconnect", impl, n->id);
|
||||||
configure_node(n, NULL);
|
configure_node(n, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ((str = spa_dict_lookup(props, PW_KEY_STREAM_DONT_REMIX)) != NULL)
|
|
||||||
n->dont_remix = pw_properties_parse_bool(str);
|
|
||||||
|
|
||||||
if (n->media == NULL) {
|
if (n->media == NULL) {
|
||||||
pw_log_debug(NAME" %p: node %d has unknown media", impl, n->id);
|
pw_log_debug(NAME" %p: node %d has unknown media", impl, n->id);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue