media-session: also create EndpointLink objects

Create an endpoint link object when linking endpoints. Keep track
of the links in the endpoint_link and cleanup when they are all
gone.

Improve properties on session objects.
This commit is contained in:
Wim Taymans 2019-11-15 17:13:45 +01:00
parent 4ccbce9932
commit 709a52e286
7 changed files with 277 additions and 60 deletions

View file

@ -83,6 +83,10 @@ static int client_session_link_update(void *object,
PW_KEY_FACTORY_ID,
PW_KEY_CLIENT_ID,
PW_KEY_SESSION_ID,
PW_KEY_ENDPOINT_LINK_OUTPUT_ENDPOINT,
PW_KEY_ENDPOINT_LINK_OUTPUT_STREAM,
PW_KEY_ENDPOINT_LINK_INPUT_ENDPOINT,
PW_KEY_ENDPOINT_LINK_INPUT_STREAM,
NULL
};
@ -94,6 +98,8 @@ static int client_session_link_update(void *object,
if (!props)
goto no_mem;
pw_properties_update_keys(props, &session->props->dict, keys);
if (info && info->props)
pw_properties_update_keys(props, info->props, keys);
if (endpoint_link_init(link, link_id, session->info.id,
this, core, props) < 0)

View file

@ -303,6 +303,8 @@ int endpoint_link_init(struct endpoint_link *this,
this->id = id;
this->props = properties;
pw_properties_setf(properties, PW_KEY_SESSION_ID, "%u", session_id);
properties = pw_properties_copy(properties);
if (!properties)
goto no_mem;
@ -314,6 +316,8 @@ int endpoint_link_init(struct endpoint_link *this,
if (!this->global)
goto no_mem;
pw_properties_setf(this->props, PW_KEY_OBJECT_ID, "%u", this->global->id);
this->info.version = PW_VERSION_ENDPOINT_LINK_INFO;
this->info.id = this->global->id;
this->info.session_id = session_id;

View file

@ -285,6 +285,8 @@ int endpoint_stream_init(struct endpoint_stream *this,
this->id = id;
this->props = properties;
pw_properties_setf(properties, PW_KEY_ENDPOINT_ID, "%u", endpoint_id);
properties = pw_properties_copy(properties);
if (!properties)
goto no_mem;
@ -296,6 +298,8 @@ int endpoint_stream_init(struct endpoint_stream *this,
if (!this->global)
goto no_mem;
pw_properties_setf(this->props, PW_KEY_OBJECT_ID, "%u", this->global->id);
this->info.version = PW_VERSION_ENDPOINT_STREAM_INFO;
this->info.id = this->global->id;
this->info.endpoint_id = endpoint_id;

View file

@ -327,7 +327,7 @@ int endpoint_init(struct endpoint *this,
if (!this->global)
goto no_mem;
pw_properties_setf(this->props, PW_KEY_ENDPOINT_ID, "%u", this->global->id);
pw_properties_setf(this->props, PW_KEY_OBJECT_ID, "%u", this->global->id);
this->info.version = PW_VERSION_ENDPOINT_INFO;
this->info.id = this->global->id;

View file

@ -294,7 +294,7 @@ int session_init(struct session *this,
if (!this->global)
goto no_mem;
pw_properties_setf(this->props, PW_KEY_SESSION_ID, "%u", this->global->id);
pw_properties_setf(this->props, PW_KEY_OBJECT_ID, "%u", this->global->id);
this->info.version = PW_VERSION_SESSION_INFO;
this->info.id = this->global->id;