Skip to content
Snippets Groups Projects
Commit e43d2d52 authored by George Kiagiadakis's avatar George Kiagiadakis
Browse files

softdsp-endpoint: destroy the DSP->node link when the DSP becomes idle

parent 3c201b61
No related branches found
No related tags found
No related merge requests found
...@@ -91,6 +91,8 @@ on_dsp_running (WpPwAudioSoftdspEndpoint *self) ...@@ -91,6 +91,8 @@ on_dsp_running (WpPwAudioSoftdspEndpoint *self)
pw_properties_setf(props, PW_LINK_INPUT_PORT_ID, "%d", -1); pw_properties_setf(props, PW_LINK_INPUT_PORT_ID, "%d", -1);
} }
g_debug ("%p linking DSP to node", self);
/* Create the link */ /* Create the link */
self->link_proxy = pw_core_proxy_create_object(self->core_proxy, self->link_proxy = pw_core_proxy_create_object(self->core_proxy,
"link-factory", PW_TYPE_INTERFACE_Link, PW_VERSION_LINK, &props->dict, 0); "link-factory", PW_TYPE_INTERFACE_Link, PW_VERSION_LINK, &props->dict, 0);
...@@ -99,6 +101,16 @@ on_dsp_running (WpPwAudioSoftdspEndpoint *self) ...@@ -99,6 +101,16 @@ on_dsp_running (WpPwAudioSoftdspEndpoint *self)
pw_properties_free(props); pw_properties_free(props);
} }
static void
on_dsp_idle (WpPwAudioSoftdspEndpoint *self)
{
if (self->link_proxy != NULL) {
g_debug ("%p unlinking DSP from node", self);
pw_proxy_destroy (self->link_proxy);
self->link_proxy = NULL;
}
}
static void static void
dsp_node_event_info (void *data, const struct pw_node_info *info) dsp_node_event_info (void *data, const struct pw_node_info *info)
{ {
...@@ -110,14 +122,15 @@ dsp_node_event_info (void *data, const struct pw_node_info *info) ...@@ -110,14 +122,15 @@ dsp_node_event_info (void *data, const struct pw_node_info *info)
/* Handle the different states */ /* Handle the different states */
switch (info->state) { switch (info->state) {
case PW_NODE_STATE_IDLE: case PW_NODE_STATE_IDLE:
break; on_dsp_idle (self);
break;
case PW_NODE_STATE_RUNNING: case PW_NODE_STATE_RUNNING:
on_dsp_running(self); on_dsp_running (self);
break; break;
case PW_NODE_STATE_SUSPENDED: case PW_NODE_STATE_SUSPENDED:
break; break;
default: default:
break; break;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment