pulse-server: use STREAM_CAPTURE_SINK for monitor capture

Make the pulseaudio layer set the PW_KEY_STREAM_CAPTURE_SINK property
when a monitor device is selected as a source to make it easier for the
session manager to find the right source.
This commit is contained in:
Wim Taymans 2021-11-19 20:24:58 +01:00
parent d4d6458b5b
commit 5ae75e1d2a
5 changed files with 12 additions and 0 deletions

View file

@ -200,6 +200,8 @@ struct module *create_module_echo_cancel(struct impl *impl, const char *argument
if (spa_strendswith(str, ".monitor")) {
pw_properties_setf(source_props, PW_KEY_NODE_TARGET,
"%.*s", (int)strlen(str)-8, str);
pw_properties_set(source_props, PW_KEY_STREAM_CAPTURE_SINK,
"true");
} else {
pw_properties_set(source_props, PW_KEY_NODE_TARGET, str);
}

View file

@ -175,6 +175,8 @@ struct module *create_module_loopback(struct impl *impl, const char *argument)
if (spa_strendswith(str, ".monitor")) {
pw_properties_setf(capture_props, PW_KEY_NODE_TARGET,
"%.*s", (int)strlen(str)-8, str);
pw_properties_set(capture_props, PW_KEY_STREAM_CAPTURE_SINK,
"true");
} else {
pw_properties_set(capture_props, PW_KEY_NODE_TARGET, str);
}

View file

@ -82,6 +82,8 @@ static int module_simple_protocol_tcp_load(struct client *client, struct module
fprintf(f, "capture.node=\"%s\" ", str);
if ((str = pw_properties_get(data->module_props, "playback.node")) != NULL)
fprintf(f, "playback.node=\"%s\" ", str);
if ((str = pw_properties_get(data->module_props, PW_KEY_STREAM_CAPTURE_SINK)) != NULL)
fprintf(f, PW_KEY_STREAM_CAPTURE_SINK"=\"%s\" ", str);
fclose(f);
data->mod = pw_context_load_module(impl->context,
@ -181,6 +183,8 @@ struct module *create_module_simple_protocol_tcp(struct impl *impl, const char *
if (spa_strendswith(str, ".monitor")) {
pw_properties_setf(module_props, "capture.node",
"%.*s", (int)strlen(str)-8, str);
pw_properties_set(module_props, PW_KEY_STREAM_CAPTURE_SINK,
"true");
} else {
pw_properties_set(module_props, "capture.node", str);
}

View file

@ -1817,6 +1817,8 @@ static int do_create_record_stream(struct client *client, uint32_t command, uint
pw_properties_setf(props,
PW_KEY_NODE_TARGET,
"%.*s", (int)strlen(source_name)-8, source_name);
pw_properties_set(props,
PW_KEY_STREAM_CAPTURE_SINK, "true");
} else {
pw_properties_set(props,
PW_KEY_NODE_TARGET, source_name);

View file

@ -388,6 +388,8 @@ static int create_streams(struct impl *impl, struct client *client)
PW_KEY_NODE_GROUP, "pipewire.dummy",
PW_KEY_NODE_LATENCY, DEFAULT_LATENCY,
PW_KEY_NODE_TARGET, pw_properties_get(impl->props, "capture.node"),
PW_KEY_STREAM_CAPTURE_SINK, pw_properties_get(impl->props,
PW_KEY_STREAM_CAPTURE_SINK),
PW_KEY_NODE_NETWORK, "true",
NULL);
if (props == NULL)