diff --git a/src/modules/module-protocol-native/protocol-native.c b/src/modules/module-protocol-native/protocol-native.c index e4c2f6ad0..45f5f45a3 100644 --- a/src/modules/module-protocol-native/protocol-native.c +++ b/src/modules/module-protocol-native/protocol-native.c @@ -385,6 +385,7 @@ static int core_event_demarshal_bound_id(void *data, const struct pw_protocol_na struct pw_proxy *proxy = data; struct spa_pod_parser prs; uint32_t id, global_id; + struct spa_dict props = SPA_DICT_INIT(NULL, 0); spa_pod_parser_init(&prs, msg->data, msg->size); if (spa_pod_parser_get_struct(&prs, @@ -392,7 +393,10 @@ static int core_event_demarshal_bound_id(void *data, const struct pw_protocol_na SPA_POD_Int(&global_id)) < 0) return -EINVAL; - return pw_proxy_notify(proxy, struct pw_core_events, bound_id, 0, id, global_id); + /* old client / old/new server -> bound_id + * new client / old server -> bound_id + bound_props (in case it's using bound_props only) */ + pw_proxy_notify(proxy, struct pw_core_events, bound_id, 0, id, global_id); + return pw_proxy_notify(proxy, struct pw_core_events, bound_props, 1, id, global_id, &props); } static int core_event_demarshal_bound_props(void *data, const struct pw_protocol_native_message *msg) @@ -413,6 +417,8 @@ static int core_event_demarshal_bound_props(void *data, const struct pw_protocol parse_dict_struct(&prs, &f[1], &props); + /* new client / new server -> bound_props + bound_id (in case it's not using bound_props yet) */ + pw_proxy_notify(proxy, struct pw_core_events, bound_id, 0, id, global_id); return pw_proxy_notify(proxy, struct pw_core_events, bound_props, 1, id, global_id, &props); } diff --git a/src/pipewire/core.c b/src/pipewire/core.c index fe6ea2c77..88f2455c3 100644 --- a/src/pipewire/core.c +++ b/src/pipewire/core.c @@ -63,26 +63,14 @@ static void core_event_remove_id(void *data, uint32_t id) pw_proxy_remove(proxy); } -static void bound_props(void *data, uint32_t id, uint32_t global_id, const struct spa_dict *props) +static void core_event_bound_id(void *data, uint32_t id, uint32_t global_id) { struct pw_core *this = data; struct pw_proxy *proxy; pw_log_debug("%p: proxy id %u bound %u", this, id, global_id); - if ((proxy = pw_map_lookup(&this->objects, id)) != NULL) { + if ((proxy = pw_map_lookup(&this->objects, id)) != NULL) pw_proxy_set_bound_id(proxy, global_id); - pw_proxy_emit_bound_props(proxy, global_id, props); - } -} - -static void core_event_bound_props(void *data, uint32_t id, uint32_t global_id, const struct spa_dict *props) -{ - bound_props(data, id, global_id, props); -} - -static void core_event_bound_id(void *data, uint32_t id, uint32_t global_id) -{ - bound_props(data, id, global_id, NULL); } static void core_event_add_mem(void *data, uint32_t id, uint32_t type, int fd, uint32_t flags) @@ -101,6 +89,16 @@ static void core_event_add_mem(void *data, uint32_t id, uint32_t type, int fd, u } } +static void core_event_bound_props(void *data, uint32_t id, uint32_t global_id, const struct spa_dict *props) +{ + struct pw_core *this = data; + struct pw_proxy *proxy; + + pw_log_debug("%p: proxy id %u bound %u", this, id, global_id); + if ((proxy = pw_map_lookup(&this->objects, id)) != NULL) + pw_proxy_emit_bound_props(proxy, global_id, props); +} + static void core_event_remove_mem(void *data, uint32_t id) { struct pw_core *this = data;