From c49771150c3e087b29e019fed113c73c2eb4621c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 26 Oct 2020 16:59:46 +0100 Subject: [PATCH] pulse-server: fill in source-output/sink-input peers --- src/modules/module-protocol-pulse/pulse-server.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index 88334f89d..07c206bec 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -2821,6 +2821,7 @@ static int fill_sink_input_info(struct client *client, struct message *m, struct sample_spec ss; struct volume volume; struct channel_map map; + struct pw_manager_object *peer; if (o == NULL || info == NULL || info->props == NULL || !is_sink_input(o)) return ERR_NOENTITY; @@ -2838,12 +2839,14 @@ static int fill_sink_input_info(struct client *client, struct message *m, .map[0] = 1, .map[1] = 2, }; + peer = find_linked(client, o->id, PW_DIRECTION_OUTPUT); + message_put(m, TAG_U32, o->id, /* sink_input index */ TAG_STRING, spa_dict_lookup(info->props, PW_KEY_MEDIA_NAME), TAG_U32, SPA_ID_INVALID, /* module index */ TAG_U32, SPA_ID_INVALID, /* client index */ - TAG_U32, SPA_ID_INVALID, /* sink index */ + TAG_U32, peer ? peer->id : SPA_ID_INVALID, /* sink index */ TAG_SAMPLE_SPEC, &ss, TAG_CHANNEL_MAP, &map, TAG_CVOLUME, &volume, @@ -2887,6 +2890,7 @@ static int fill_source_output_info(struct client *client, struct message *m, struct sample_spec ss; struct volume volume; struct channel_map map; + struct pw_manager_object *peer; if (o == NULL || info == NULL || info->props == NULL || !is_source_output(o)) return ERR_NOENTITY; @@ -2904,12 +2908,14 @@ static int fill_source_output_info(struct client *client, struct message *m, .map[0] = 1, .map[1] = 2, }; + peer = find_linked(client, o->id, PW_DIRECTION_OUTPUT); + message_put(m, TAG_U32, o->id, /* source_output index */ TAG_STRING, spa_dict_lookup(info->props, PW_KEY_MEDIA_NAME), TAG_U32, SPA_ID_INVALID, /* module index */ TAG_U32, SPA_ID_INVALID, /* client index */ - TAG_U32, SPA_ID_INVALID, /* source index */ + TAG_U32, peer ? peer->id : SPA_ID_INVALID, /* source index */ TAG_SAMPLE_SPEC, &ss, TAG_CHANNEL_MAP, &map, TAG_USEC, 0LL, /* latency */