mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	media-session: track our DSP link
Set our DSP link proxy to NULL when it gets destroyed so that we don't accidentally try to do things with it anymore.
This commit is contained in:
		
							parent
							
								
									ac6a568729
								
							
						
					
					
						commit
						11769aa7e7
					
				
					 2 changed files with 17 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -152,6 +152,7 @@ struct session {
 | 
			
		|||
	struct node *dsp;
 | 
			
		||||
	struct pw_proxy *dsp_proxy;
 | 
			
		||||
	struct pw_proxy *link_proxy;
 | 
			
		||||
	struct spa_hook link_listener;
 | 
			
		||||
 | 
			
		||||
	struct spa_list node_list;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -272,6 +273,17 @@ static int on_node_idle(struct impl *impl, struct node *node)
 | 
			
		|||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void link_proxy_destroy(void *data)
 | 
			
		||||
{
 | 
			
		||||
	struct session *s = data;
 | 
			
		||||
	pw_log_debug(NAME " %p: proxy destroy session link", s);
 | 
			
		||||
	s->link_proxy = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct pw_proxy_events link_proxy_events = {
 | 
			
		||||
	PW_VERSION_PROXY_EVENTS,
 | 
			
		||||
	.destroy = link_proxy_destroy,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static int link_session_dsp(struct impl *impl, struct session *session)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -303,6 +315,7 @@ static int link_session_dsp(struct impl *impl, struct session *session)
 | 
			
		|||
                                          PW_VERSION_LINK,
 | 
			
		||||
                                          &props->dict,
 | 
			
		||||
					  0);
 | 
			
		||||
	pw_proxy_add_listener(session->link_proxy, &session->link_listener, &link_proxy_events, session);
 | 
			
		||||
	pw_properties_free(props);
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -415,6 +428,9 @@ static void remove_session(struct impl *impl, struct session *sess)
 | 
			
		|||
			pw_core_proxy_destroy(impl->core_proxy, sess->dsp_proxy);
 | 
			
		||||
		sess->dsp_proxy = NULL;
 | 
			
		||||
	}
 | 
			
		||||
	if (sess->link_proxy) {
 | 
			
		||||
		spa_hook_remove(&sess->link_listener);
 | 
			
		||||
	}
 | 
			
		||||
	spa_list_remove(&sess->l);
 | 
			
		||||
	free(sess);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue