From 17d4b4614433d4fbef0a431029dbbfb935da36f0 Mon Sep 17 00:00:00 2001 From: George Kiagiadakis <george.kiagiadakis@collabora.com> Date: Tue, 31 Mar 2020 19:31:54 +0300 Subject: [PATCH] endpoint & stream: use wp_session_item_get_associated_proxy_id() --- lib/wp/endpoint-stream.c | 16 +++++----------- lib/wp/endpoint.c | 16 +++++----------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/lib/wp/endpoint-stream.c b/lib/wp/endpoint-stream.c index c59c2c44..398bdba8 100644 --- a/lib/wp/endpoint-stream.c +++ b/lib/wp/endpoint-stream.c @@ -704,27 +704,21 @@ wp_impl_endpoint_stream_augment (WpProxy * proxy, WpProxyFeatures features) if (features & WP_PROXY_FEATURE_INFO) { const gchar *key, *value; - g_autoptr (WpProxy) endpoint = NULL; /* get info from the interface */ info = wp_si_stream_get_registration_info (self->item); g_variant_get (info, "(sa{ss})", &self->info.name, &immutable_props); + /* associate with the endpoint */ + self->info.endpoint_id = wp_session_item_get_associated_proxy_id ( + WP_SESSION_ITEM (self->item), WP_TYPE_ENDPOINT); + /* construct export properties (these will come back through the registry and appear in wp_proxy_get_global_properties) */ props = wp_properties_new ( PW_KEY_ENDPOINT_STREAM_NAME, self->info.name, NULL); - - /* associate with the endpoint */ - endpoint = wp_session_item_get_associated_proxy ( - WP_SESSION_ITEM (self->item), WP_TYPE_ENDPOINT); - if (endpoint) { - self->info.endpoint_id = wp_proxy_get_bound_id (endpoint); - wp_properties_setf (props, PW_KEY_ENDPOINT_ID, "%u", self->info.endpoint_id); - } else { - self->info.endpoint_id = SPA_ID_INVALID; - } + wp_properties_setf (props, PW_KEY_ENDPOINT_ID, "%d", self->info.endpoint_id); /* populate immutable (global) properties */ while (g_variant_iter_next (immutable_props, "{&s&s}", &key, &value)) diff --git a/lib/wp/endpoint.c b/lib/wp/endpoint.c index 80999e1a..7f4d5945 100644 --- a/lib/wp/endpoint.c +++ b/lib/wp/endpoint.c @@ -889,7 +889,6 @@ wp_impl_endpoint_augment (WpProxy * proxy, WpProxyFeatures features) if (features & WP_PROXY_FEATURE_INFO) { guchar direction; const gchar *key, *value; - g_autoptr (WpProxy) session = NULL; /* get info from the interface */ info = wp_si_endpoint_get_registration_info (self->item); @@ -899,22 +898,17 @@ wp_impl_endpoint_augment (WpProxy * proxy, WpProxyFeatures features) self->info.direction = (enum pw_direction) direction; self->info.n_streams = wp_si_endpoint_get_n_streams (self->item); + /* associate with the session */ + self->info.session_id = wp_session_item_get_associated_proxy_id ( + WP_SESSION_ITEM (self->item), WP_TYPE_SESSION); + /* construct export properties (these will come back through the registry and appear in wp_proxy_get_global_properties) */ props = wp_properties_new ( PW_KEY_ENDPOINT_NAME, self->info.name, PW_KEY_MEDIA_CLASS, self->info.media_class, NULL); - - /* associate with the session */ - session = wp_session_item_get_associated_proxy ( - WP_SESSION_ITEM (self->item), WP_TYPE_SESSION); - if (session) { - self->info.session_id = wp_proxy_get_bound_id (session); - wp_properties_setf (props, PW_KEY_SESSION_ID, "%u", self->info.session_id); - } else { - self->info.session_id = SPA_ID_INVALID; - } + wp_properties_setf (props, PW_KEY_SESSION_ID, "%d", self->info.session_id); /* populate immutable (global) properties */ while (g_variant_iter_next (immutable_props, "{&s&s}", &key, &value)) -- GitLab