mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
stream: handle proxy destroy
When the proxy is destroyed, mark the stream as unconnected and remove our reference to the proxy.
This commit is contained in:
parent
2025a9ad3b
commit
3be759ced2
3 changed files with 16 additions and 0 deletions
|
|
@ -598,7 +598,9 @@ struct pw_stream {
|
||||||
char *error; /**< error reason when state is in error */
|
char *error; /**< error reason when state is in error */
|
||||||
|
|
||||||
struct spa_hook_list listener_list;
|
struct spa_hook_list listener_list;
|
||||||
|
|
||||||
struct pw_proxy *proxy;
|
struct pw_proxy *proxy;
|
||||||
|
struct spa_hook proxy_listener;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define pw_factory_events_emit(s,m,v,...) spa_hook_list_call(&s->listener_list, struct pw_factory_events, m, v, ##__VA_ARGS__)
|
#define pw_factory_events_emit(s,m,v,...) spa_hook_list_call(&s->listener_list, struct pw_factory_events, m, v, ##__VA_ARGS__)
|
||||||
|
|
|
||||||
|
|
@ -317,6 +317,7 @@ void pw_remote_destroy(struct pw_remote *remote)
|
||||||
|
|
||||||
pw_map_clear(&remote->objects);
|
pw_map_clear(&remote->objects);
|
||||||
|
|
||||||
|
pw_log_debug("remote %p: free", remote);
|
||||||
if (remote->properties)
|
if (remote->properties)
|
||||||
pw_properties_free(remote->properties);
|
pw_properties_free(remote->properties);
|
||||||
free(remote->error);
|
free(remote->error);
|
||||||
|
|
|
||||||
|
|
@ -784,6 +784,18 @@ static const struct spa_node impl_node = {
|
||||||
.port_reuse_buffer = impl_port_reuse_buffer,
|
.port_reuse_buffer = impl_port_reuse_buffer,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void proxy_destroy(void *_data)
|
||||||
|
{
|
||||||
|
struct pw_stream *stream = _data;
|
||||||
|
stream->proxy = NULL;
|
||||||
|
stream_set_state(stream, PW_STREAM_STATE_UNCONNECTED, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct pw_proxy_events proxy_events = {
|
||||||
|
PW_VERSION_PROXY_EVENTS,
|
||||||
|
.destroy = proxy_destroy,
|
||||||
|
};
|
||||||
|
|
||||||
static int handle_connect(struct pw_stream *stream)
|
static int handle_connect(struct pw_stream *stream)
|
||||||
{
|
{
|
||||||
struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this);
|
struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this);
|
||||||
|
|
@ -806,6 +818,7 @@ static int handle_connect(struct pw_stream *stream)
|
||||||
|
|
||||||
pw_log_debug("stream %p: export node %p", stream, impl->node);
|
pw_log_debug("stream %p: export node %p", stream, impl->node);
|
||||||
stream->proxy = pw_remote_export(stream->remote, impl->node);
|
stream->proxy = pw_remote_export(stream->remote, impl->node);
|
||||||
|
pw_proxy_add_listener(stream->proxy, &stream->proxy_listener, &proxy_events, stream);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue