mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-14 06:59:57 -05:00
stream: destroy proxy
When our proxy is removed or when we destroy it, remove our listeners and go to the unconnected state. Destroy the proxy in all cases.
This commit is contained in:
parent
969377b079
commit
bf4ccc00bf
2 changed files with 23 additions and 4 deletions
|
|
@ -878,15 +878,21 @@ static const struct spa_node_methods impl_node = {
|
|||
.process = impl_node_process,
|
||||
};
|
||||
|
||||
static void proxy_destroy(void *_data)
|
||||
static void proxy_removed(void *_data)
|
||||
{
|
||||
struct pw_filter *filter = _data;
|
||||
filter->proxy = NULL;
|
||||
spa_hook_remove(&filter->proxy_listener);
|
||||
filter->node_id = SPA_ID_INVALID;
|
||||
filter_set_state(filter, PW_FILTER_STATE_UNCONNECTED, NULL);
|
||||
}
|
||||
|
||||
static void proxy_destroy(void *_data)
|
||||
{
|
||||
struct pw_filter *filter = _data;
|
||||
proxy_removed(_data);
|
||||
filter->proxy = NULL;
|
||||
}
|
||||
|
||||
static void proxy_error(void *_data, int seq, int res, const char *message)
|
||||
{
|
||||
struct pw_filter *filter = _data;
|
||||
|
|
@ -902,6 +908,7 @@ static void proxy_bound(void *_data, uint32_t global_id)
|
|||
|
||||
static const struct pw_proxy_events proxy_events = {
|
||||
PW_VERSION_PROXY_EVENTS,
|
||||
.removed = proxy_removed,
|
||||
.destroy = proxy_destroy,
|
||||
.error = proxy_error,
|
||||
.bound = proxy_bound,
|
||||
|
|
|
|||
|
|
@ -827,15 +827,23 @@ static const struct spa_node_methods impl_node = {
|
|||
.port_reuse_buffer = impl_port_reuse_buffer,
|
||||
};
|
||||
|
||||
static void proxy_destroy(void *_data)
|
||||
static void proxy_removed(void *_data)
|
||||
{
|
||||
struct pw_stream *stream = _data;
|
||||
stream->proxy = NULL;
|
||||
pw_log_debug(NAME" %p: removed", stream);
|
||||
spa_hook_remove(&stream->proxy_listener);
|
||||
stream->node_id = SPA_ID_INVALID;
|
||||
stream_set_state(stream, PW_STREAM_STATE_UNCONNECTED, NULL);
|
||||
}
|
||||
|
||||
static void proxy_destroy(void *_data)
|
||||
{
|
||||
struct pw_stream *stream = _data;
|
||||
pw_log_debug(NAME" %p: destroy", stream);
|
||||
proxy_removed(_data);
|
||||
stream->proxy = NULL;
|
||||
}
|
||||
|
||||
static void proxy_error(void *_data, int seq, int res, const char *message)
|
||||
{
|
||||
struct pw_stream *stream = _data;
|
||||
|
|
@ -851,6 +859,7 @@ static void proxy_bound(void *data, uint32_t global_id)
|
|||
|
||||
static const struct pw_proxy_events proxy_events = {
|
||||
PW_VERSION_PROXY_EVENTS,
|
||||
.removed = proxy_removed,
|
||||
.destroy = proxy_destroy,
|
||||
.error = proxy_error,
|
||||
.bound = proxy_bound,
|
||||
|
|
@ -1573,6 +1582,9 @@ int pw_stream_disconnect(struct pw_stream *stream)
|
|||
if (impl->node)
|
||||
pw_impl_node_set_active(impl->node, false);
|
||||
|
||||
if (stream->proxy)
|
||||
pw_proxy_destroy(stream->proxy);
|
||||
|
||||
if (impl->node) {
|
||||
pw_impl_node_destroy(impl->node);
|
||||
impl->node = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue