summaryrefslogtreecommitdiff
path: root/src/examples
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2019-01-29 10:29:06 +0100
committerWim Taymans <wtaymans@redhat.com>2019-01-29 10:29:06 +0100
commit11769aa7e748fef8f842e3c0bd833602bc3e4032 (patch)
tree3a31839f0f647812c88c352929cb55549114f7a2 /src/examples
parentac6a568729a7bbbb82d6714d3b8087cd09d349b2 (diff)
media-session: track our DSP link
Set our DSP link proxy to NULL when it gets destroyed so that we don't accidentally try to do things with it anymore.
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/media-session.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/examples/media-session.c b/src/examples/media-session.c
index c01423ae..f9af0898 100644
--- a/src/examples/media-session.c
+++ b/src/examples/media-session.c
@@ -152,6 +152,7 @@ struct session {
struct node *dsp;
struct pw_proxy *dsp_proxy;
struct pw_proxy *link_proxy;
+ struct spa_hook link_listener;
struct spa_list node_list;
@@ -272,6 +273,17 @@ static int on_node_idle(struct impl *impl, struct node *node)
return 0;
}
+static void link_proxy_destroy(void *data)
+{
+ struct session *s = data;
+ pw_log_debug(NAME " %p: proxy destroy session link", s);
+ s->link_proxy = NULL;
+}
+
+static const struct pw_proxy_events link_proxy_events = {
+ PW_VERSION_PROXY_EVENTS,
+ .destroy = link_proxy_destroy,
+};
static int link_session_dsp(struct impl *impl, struct session *session)
{
@@ -303,6 +315,7 @@ static int link_session_dsp(struct impl *impl, struct session *session)
PW_VERSION_LINK,
&props->dict,
0);
+ pw_proxy_add_listener(session->link_proxy, &session->link_listener, &link_proxy_events, session);
pw_properties_free(props);
return 0;
@@ -415,6 +428,9 @@ static void remove_session(struct impl *impl, struct session *sess)
pw_core_proxy_destroy(impl->core_proxy, sess->dsp_proxy);
sess->dsp_proxy = NULL;
}
+ if (sess->link_proxy) {
+ spa_hook_remove(&sess->link_listener);
+ }
spa_list_remove(&sess->l);
free(sess);
}