mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	proxy: reuse id when server removed it
reset number of fds before we begin reading. When we destroy the proxy, just clear the id. We then remove the id completely when the server sends a remove_id request. This avoid reusing the proxy id before the server has finished with it. Add some debug
This commit is contained in:
		
							parent
							
								
									41a3a924ef
								
							
						
					
					
						commit
						95d45e4206
					
				
					 4 changed files with 7 additions and 1 deletions
				
			
		| 
						 | 
					@ -158,6 +158,7 @@ static bool refill_buffer(struct pw_protocol_native_connection *conn, struct buf
 | 
				
			||||||
	buf->buffer_size += len;
 | 
						buf->buffer_size += len;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* handle control messages */
 | 
						/* handle control messages */
 | 
				
			||||||
 | 
						buf->n_fds = 0;
 | 
				
			||||||
	for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
 | 
						for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
 | 
				
			||||||
		if (cmsg->cmsg_level != SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS)
 | 
							if (cmsg->cmsg_level != SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -121,7 +121,7 @@ void pw_proxy_destroy(struct pw_proxy *proxy)
 | 
				
			||||||
	pw_log_debug("proxy %p: destroy %u", proxy, proxy->id);
 | 
						pw_log_debug("proxy %p: destroy %u", proxy, proxy->id);
 | 
				
			||||||
	spa_hook_list_call(&proxy->listener_list, struct pw_proxy_events, destroy);
 | 
						spa_hook_list_call(&proxy->listener_list, struct pw_proxy_events, destroy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_map_remove(&proxy->remote->objects, proxy->id);
 | 
						pw_map_insert_at(&proxy->remote->objects, proxy->id, NULL);
 | 
				
			||||||
	spa_list_remove(&proxy->link);
 | 
						spa_list_remove(&proxy->link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	free(impl);
 | 
						free(impl);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -189,6 +189,7 @@ static void core_event_remove_id(void *data, uint32_t id)
 | 
				
			||||||
		pw_log_debug("remote %p: object remove %u", this, id);
 | 
							pw_log_debug("remote %p: object remove %u", this, id);
 | 
				
			||||||
		pw_proxy_destroy(proxy);
 | 
							pw_proxy_destroy(proxy);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						pw_map_remove(&this->objects, id);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -642,6 +642,8 @@ 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);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pw_log_debug("stream %p: creating proxy", stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl->node = pw_node_new(impl->core, "export-source",
 | 
						impl->node = pw_node_new(impl->core, "export-source",
 | 
				
			||||||
			pw_properties_copy(stream->properties), 0);
 | 
								pw_properties_copy(stream->properties), 0);
 | 
				
			||||||
	impl->impl_node = impl_node;
 | 
						impl->impl_node = impl_node;
 | 
				
			||||||
| 
						 | 
					@ -857,6 +859,7 @@ pw_stream_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);
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pw_log_debug("stream %p: connect", stream);
 | 
				
			||||||
	impl->direction =
 | 
						impl->direction =
 | 
				
			||||||
	    direction == PW_DIRECTION_INPUT ? SPA_DIRECTION_INPUT : SPA_DIRECTION_OUTPUT;
 | 
						    direction == PW_DIRECTION_INPUT ? SPA_DIRECTION_INPUT : SPA_DIRECTION_OUTPUT;
 | 
				
			||||||
	impl->flags = flags;
 | 
						impl->flags = flags;
 | 
				
			||||||
| 
						 | 
					@ -890,6 +893,7 @@ int pw_stream_disconnect(struct pw_stream *stream)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this);
 | 
						struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pw_log_debug("stream %p: disconnect", stream);
 | 
				
			||||||
	impl->disconnecting = true;
 | 
						impl->disconnecting = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (impl->node) {
 | 
						if (impl->node) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue