stream: disconnect the core_proxy when needed

This commit is contained in:
Wim Taymans 2019-12-06 22:13:01 +01:00
parent a8c3dc6a8a
commit 9b1c3c211e
2 changed files with 16 additions and 2 deletions

View file

@ -138,6 +138,7 @@ struct filter {
unsigned int disconnecting:1;
unsigned int free_data:1;
unsigned int free_proxy:1;
unsigned int subscribe:1;
unsigned int draining:1;
};
@ -1171,6 +1172,7 @@ pw_filter_connect(struct pw_filter *filter,
spa_list_append(&filter->core_proxy->filter_list, &filter->link);
pw_core_proxy_add_listener(filter->core_proxy,
&filter->core_listener, &core_events, filter);
impl->free_proxy = true;
}
pw_log_debug(NAME" %p: creating node", filter);
@ -1236,7 +1238,12 @@ int pw_filter_disconnect(struct pw_filter *filter)
pw_node_destroy(impl->node);
impl->node = NULL;
}
if (filter->core_proxy && impl->free_proxy) {
spa_hook_remove(&filter->core_listener);
spa_list_remove(&filter->link);
pw_core_proxy_disconnect(filter->core_proxy);
filter->core_proxy = NULL;
}
return 0;
}

View file

@ -124,6 +124,7 @@ struct stream {
unsigned int disconnecting:1;
unsigned int free_data:1;
unsigned int free_proxy:1;
unsigned int alloc_buffers:1;
unsigned int draining:1;
};
@ -1384,6 +1385,7 @@ pw_stream_connect(struct pw_stream *stream,
spa_list_append(&stream->core_proxy->stream_list, &stream->link);
pw_core_proxy_add_listener(stream->core_proxy,
&stream->core_listener, &core_events, stream);
impl->free_proxy = true;
}
pw_log_debug(NAME" %p: creating node", stream);
@ -1478,7 +1480,12 @@ int pw_stream_disconnect(struct pw_stream *stream)
pw_node_destroy(impl->node);
impl->node = NULL;
}
if (stream->core_proxy && impl->free_proxy) {
spa_hook_remove(&stream->core_listener);
spa_list_remove(&stream->link);
pw_core_proxy_disconnect(stream->core_proxy);
stream->core_proxy = NULL;
}
return 0;
}