From f2ce69c4bd8ad9ef11ee3981e6c381508112f872 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 15 Nov 2019 18:49:10 +0100 Subject: [PATCH] media-session: pass the client.id in the endpoint Pass the client.id that we made this endpoint for in the endpoint properties. This makes it possible to let pulse find the client that belongs to the endpiont. The client.id is used to find the client that actually made the object (the session manager) --- pipewire-pulseaudio/src/context.c | 4 +++- src/examples/media-session/stream-monitor.c | 2 ++ src/extensions/session-manager/keys.h | 1 + src/modules/module-session-manager/endpoint.c | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pipewire-pulseaudio/src/context.c b/pipewire-pulseaudio/src/context.c index ce7e0199b..dec05b03c 100644 --- a/pipewire-pulseaudio/src/context.c +++ b/pipewire-pulseaudio/src/context.c @@ -639,7 +639,9 @@ static int set_mask(pa_context *c, struct global *g) g->event = PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT; } - if ((str = pw_properties_get(g->props, PW_KEY_CLIENT_ID)) != NULL) + if ((str = pw_properties_get(g->props, PW_KEY_ENDPOINT_CLIENT_ID)) != NULL) + g->endpoint_info.client_id = atoi(str); + else if ((str = pw_properties_get(g->props, PW_KEY_CLIENT_ID)) != NULL) g->endpoint_info.client_id = atoi(str); if ((str = pw_properties_get(g->props, PW_KEY_DEVICE_ID)) != NULL) g->endpoint_info.device_id = atoi(str); diff --git a/src/examples/media-session/stream-monitor.c b/src/examples/media-session/stream-monitor.c index a3dccc837..4a92f9ac3 100644 --- a/src/examples/media-session/stream-monitor.c +++ b/src/examples/media-session/stream-monitor.c @@ -244,6 +244,8 @@ static struct client_endpoint *make_endpoint(struct node *node) pw_properties_set(props, PW_KEY_ENDPOINT_NAME, name); if ((str = spa_dict_lookup(dict, PW_KEY_OBJECT_ID)) != NULL) pw_properties_set(props, PW_KEY_NODE_ID, str); + if ((str = spa_dict_lookup(dict, PW_KEY_CLIENT_ID)) != NULL) + pw_properties_set(props, PW_KEY_ENDPOINT_CLIENT_ID, str); if ((str = spa_dict_lookup(dict, PW_KEY_NODE_AUTOCONNECT)) != NULL) pw_properties_set(props, PW_KEY_ENDPOINT_AUTOCONNECT, str); if ((str = spa_dict_lookup(dict, PW_KEY_NODE_TARGET)) != NULL) diff --git a/src/extensions/session-manager/keys.h b/src/extensions/session-manager/keys.h index 4b3ffeddc..9d5c2e324 100644 --- a/src/extensions/session-manager/keys.h +++ b/src/extensions/session-manager/keys.h @@ -34,6 +34,7 @@ extern "C" { #define PW_KEY_ENDPOINT_ID "endpoint.id" /**< id of an endpoint */ #define PW_KEY_ENDPOINT_NAME "endpoint.name" /**< the name of an endpoint */ +#define PW_KEY_ENDPOINT_CLIENT_ID "endpoint.client.id" /**< client of the endpoint */ #define PW_KEY_ENDPOINT_ICON_NAME "endpoint.icon-name" /**< an XDG icon name for the device. * Ex. "sound-card-speakers-usb" */ #define PW_KEY_ENDPOINT_AUTOCONNECT "endpoint.autoconnect" /**< try to automatically connect this diff --git a/src/modules/module-session-manager/endpoint.c b/src/modules/module-session-manager/endpoint.c index f219542b0..d66f7cefa 100644 --- a/src/modules/module-session-manager/endpoint.c +++ b/src/modules/module-session-manager/endpoint.c @@ -306,6 +306,7 @@ int endpoint_init(struct endpoint *this, PW_KEY_MEDIA_CLASS, PW_KEY_PRIORITY_SESSION, PW_KEY_ENDPOINT_NAME, + PW_KEY_ENDPOINT_CLIENT_ID, PW_KEY_ENDPOINT_ICON_NAME, NULL };