mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	modules: add pid to unique name
So that modules loaded from different processes don't generate the same node names.
This commit is contained in:
		
							parent
							
								
									2922b0e108
								
							
						
					
					
						commit
						cc39644253
					
				
					 6 changed files with 21 additions and 19 deletions
				
			
		| 
						 | 
				
			
			@ -398,6 +398,7 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
			
		|||
	struct pw_properties *props;
 | 
			
		||||
	struct impl *impl;
 | 
			
		||||
	uint32_t id = pw_global_get_id(pw_impl_module_get_global(module));
 | 
			
		||||
	uint32_t pid = getpid();
 | 
			
		||||
	const char *str;
 | 
			
		||||
	int res;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -431,15 +432,15 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
			
		|||
	impl->context = context;
 | 
			
		||||
 | 
			
		||||
	if (pw_properties_get(props, PW_KEY_NODE_GROUP) == NULL)
 | 
			
		||||
		pw_properties_setf(props, PW_KEY_NODE_GROUP, "loopback-%u", id);
 | 
			
		||||
		pw_properties_setf(props, PW_KEY_NODE_GROUP, "loopback-%u-%u", pid, id);
 | 
			
		||||
	if (pw_properties_get(props, PW_KEY_NODE_LINK_GROUP) == NULL)
 | 
			
		||||
		pw_properties_setf(props, PW_KEY_NODE_LINK_GROUP, "loopback-%u", id);
 | 
			
		||||
		pw_properties_setf(props, PW_KEY_NODE_LINK_GROUP, "loopback-%u-%u", pid, id);
 | 
			
		||||
	if (pw_properties_get(props, PW_KEY_NODE_VIRTUAL) == NULL)
 | 
			
		||||
		pw_properties_set(props, PW_KEY_NODE_VIRTUAL, "true");
 | 
			
		||||
 | 
			
		||||
	if (pw_properties_get(props, PW_KEY_NODE_DESCRIPTION) == NULL)
 | 
			
		||||
		pw_properties_setf(props, PW_KEY_NODE_DESCRIPTION,
 | 
			
		||||
				"loopback-%u", id);
 | 
			
		||||
				"loopback-%u-%u", pid, id);
 | 
			
		||||
 | 
			
		||||
	if ((str = pw_properties_get(props, "capture.props")) != NULL)
 | 
			
		||||
		pw_properties_update_string(impl->capture_props, str, strlen(str));
 | 
			
		||||
| 
						 | 
				
			
			@ -458,10 +459,10 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
			
		|||
 | 
			
		||||
	if (pw_properties_get(impl->capture_props, PW_KEY_NODE_NAME) == NULL)
 | 
			
		||||
		pw_properties_setf(impl->capture_props, PW_KEY_NODE_NAME,
 | 
			
		||||
				"input.loopback-%u", id);
 | 
			
		||||
				"input.loopback-%u-%u", pid, id);
 | 
			
		||||
	if (pw_properties_get(impl->playback_props, PW_KEY_NODE_NAME) == NULL)
 | 
			
		||||
		pw_properties_setf(impl->playback_props, PW_KEY_NODE_NAME,
 | 
			
		||||
				"output.loopback-%u", id);
 | 
			
		||||
				"output.loopback-%u-%u", pid, id);
 | 
			
		||||
 | 
			
		||||
	parse_audio_info(impl->capture_props, &impl->capture_info);
 | 
			
		||||
	parse_audio_info(impl->playback_props, &impl->playback_info);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue