mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pw-link: handle link proxy destruction
If for some reason the proxy gets destroyed, we make sure to remove listeners and forget the proxy pointer. We do not however delete the target_link; we consider the proxy destruction as an error. If another definitive state occured on the link (got to paused state, got an error), then that event will be ignored. Else we consider it an error.
This commit is contained in:
		
							parent
							
								
									7ebc1b05d2
								
							
						
					
					
						commit
						ecffe3cbd6
					
				
					 1 changed files with 12 additions and 0 deletions
				
			
		| 
						 | 
					@ -104,6 +104,17 @@ static void link_event(struct target_link *tl, enum pw_link_state state, int res
 | 
				
			||||||
	pw_main_loop_quit(tl->data->loop);
 | 
						pw_main_loop_quit(tl->data->loop);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void link_proxy_destroy(void *data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct target_link *tl = data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spa_hook_remove(&tl->listener);
 | 
				
			||||||
 | 
						spa_hook_remove(&tl->link_listener);
 | 
				
			||||||
 | 
						tl->proxy = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						link_event(tl, PW_LINK_STATE_ERROR, -EINVAL);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void link_proxy_error(void *data, int seq, int res, const char *message)
 | 
					static void link_proxy_error(void *data, int seq, int res, const char *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct target_link *tl = data;
 | 
						struct target_link *tl = data;
 | 
				
			||||||
| 
						 | 
					@ -112,6 +123,7 @@ static void link_proxy_error(void *data, int seq, int res, const char *message)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct pw_proxy_events link_proxy_events = {
 | 
					static const struct pw_proxy_events link_proxy_events = {
 | 
				
			||||||
	PW_VERSION_PROXY_EVENTS,
 | 
						PW_VERSION_PROXY_EVENTS,
 | 
				
			||||||
 | 
						.destroy = link_proxy_destroy,
 | 
				
			||||||
	.error = link_proxy_error,
 | 
						.error = link_proxy_error,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue