From ab353a8057cb79a2ae09f4438d7890f28f13b51f Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sun, 27 Feb 2022 20:44:21 +0200 Subject: [PATCH] module-session-manager: set object.serial on session objects Session, endpoint, link, and stream objects should also set object.serial. --- src/modules/module-session-manager/endpoint-link.c | 13 +++++++++++++ .../module-session-manager/endpoint-stream.c | 13 +++++++++++++ src/modules/module-session-manager/endpoint.c | 13 +++++++++++++ src/modules/module-session-manager/session.c | 13 +++++++++++++ 4 files changed, 52 insertions(+) diff --git a/src/modules/module-session-manager/endpoint-link.c b/src/modules/module-session-manager/endpoint-link.c index c1940c5e4..326af3c56 100644 --- a/src/modules/module-session-manager/endpoint-link.c +++ b/src/modules/module-session-manager/endpoint-link.c @@ -389,6 +389,15 @@ static void *link_new(struct pw_context *context, struct pw_properties *properties) { struct impl *impl; + char serial_str[32]; + struct spa_dict_item items[1] = { + SPA_DICT_ITEM_INIT(PW_KEY_OBJECT_SERIAL, serial_str), + }; + struct spa_dict extra_props = SPA_DICT_INIT_ARRAY(items); + static const char * const keys[] = { + PW_KEY_OBJECT_SERIAL, + NULL + }; impl = calloc(1, sizeof(*impl)); if (impl == NULL) { @@ -407,6 +416,10 @@ static void *link_new(struct pw_context *context, } impl->resource = resource; + spa_scnprintf(serial_str, sizeof(serial_str), "%"PRIu64, + pw_global_get_serial(impl->global)); + pw_global_update_keys(impl->global, &extra_props, keys); + spa_list_init(&impl->cached_params); /* handle destroy events */ diff --git a/src/modules/module-session-manager/endpoint-stream.c b/src/modules/module-session-manager/endpoint-stream.c index 3d71cba83..939e28e6c 100644 --- a/src/modules/module-session-manager/endpoint-stream.c +++ b/src/modules/module-session-manager/endpoint-stream.c @@ -380,6 +380,15 @@ static void *stream_new(struct pw_context *context, struct pw_properties *properties) { struct impl *impl; + char serial_str[32]; + struct spa_dict_item items[1] = { + SPA_DICT_ITEM_INIT(PW_KEY_OBJECT_SERIAL, serial_str), + }; + struct spa_dict extra_props = SPA_DICT_INIT_ARRAY(items); + static const char * const keys[] = { + PW_KEY_OBJECT_SERIAL, + NULL + }; impl = calloc(1, sizeof(*impl)); if (impl == NULL) { @@ -398,6 +407,10 @@ static void *stream_new(struct pw_context *context, } impl->resource = resource; + spa_scnprintf(serial_str, sizeof(serial_str), "%"PRIu64, + pw_global_get_serial(impl->global)); + pw_global_update_keys(impl->global, &extra_props, keys); + spa_list_init(&impl->cached_params); /* handle destroy events */ diff --git a/src/modules/module-session-manager/endpoint.c b/src/modules/module-session-manager/endpoint.c index 090933373..41425cdba 100644 --- a/src/modules/module-session-manager/endpoint.c +++ b/src/modules/module-session-manager/endpoint.c @@ -389,6 +389,15 @@ static void *endpoint_new(struct pw_context *context, struct pw_properties *properties) { struct impl *impl; + char serial_str[32]; + struct spa_dict_item items[1] = { + SPA_DICT_ITEM_INIT(PW_KEY_OBJECT_SERIAL, serial_str), + }; + struct spa_dict extra_props = SPA_DICT_INIT_ARRAY(items); + static const char * const keys[] = { + PW_KEY_OBJECT_SERIAL, + NULL + }; impl = calloc(1, sizeof(*impl)); if (impl == NULL) { @@ -407,6 +416,10 @@ static void *endpoint_new(struct pw_context *context, } impl->resource = resource; + spa_scnprintf(serial_str, sizeof(serial_str), "%"PRIu64, + pw_global_get_serial(impl->global)); + pw_global_update_keys(impl->global, &extra_props, keys); + spa_list_init(&impl->cached_params); /* handle destroy events */ diff --git a/src/modules/module-session-manager/session.c b/src/modules/module-session-manager/session.c index c9d7a9fc8..35e4fccfa 100644 --- a/src/modules/module-session-manager/session.c +++ b/src/modules/module-session-manager/session.c @@ -378,6 +378,15 @@ static void *session_new(struct pw_context *context, struct pw_properties *properties) { struct impl *impl; + char serial_str[32]; + struct spa_dict_item items[1] = { + SPA_DICT_ITEM_INIT(PW_KEY_OBJECT_SERIAL, serial_str), + }; + struct spa_dict extra_props = SPA_DICT_INIT_ARRAY(items); + static const char * const keys[] = { + PW_KEY_OBJECT_SERIAL, + NULL + }; impl = calloc(1, sizeof(*impl)); if (impl == NULL) { @@ -396,6 +405,10 @@ static void *session_new(struct pw_context *context, } impl->resource = resource; + spa_scnprintf(serial_str, sizeof(serial_str), "%"PRIu64, + pw_global_get_serial(impl->global)); + pw_global_update_keys(impl->global, &extra_props, keys); + spa_list_init(&impl->cached_params); /* handle destroy events */