mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse-server: append remote name to native socket
This way we don't interfere with the pulseaudio daemon in any way and we can implement fallback to pulse-server in the pulseaudio client library config file.
This commit is contained in:
		
							parent
							
								
									6c7a84a0ff
								
							
						
					
					
						commit
						c368768b93
					
				
					 2 changed files with 19 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -4375,8 +4375,24 @@ static void server_free(struct server *server)
 | 
			
		|||
	free(server);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const char *
 | 
			
		||||
get_server_name(struct pw_context *context)
 | 
			
		||||
{
 | 
			
		||||
	const char *name = NULL;
 | 
			
		||||
	const struct pw_properties *props = pw_context_get_properties(context);
 | 
			
		||||
 | 
			
		||||
	if (props)
 | 
			
		||||
		name = pw_properties_get(props, PW_KEY_REMOTE_NAME);
 | 
			
		||||
	if (name == NULL)
 | 
			
		||||
		name = getenv("PIPEWIRE_REMOTE");
 | 
			
		||||
	if (name == NULL)
 | 
			
		||||
		name = PW_DEFAULT_REMOTE;
 | 
			
		||||
	return name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int make_local_socket(struct server *server, char *name)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl = server->impl;
 | 
			
		||||
	char runtime_dir[PATH_MAX];
 | 
			
		||||
	socklen_t size;
 | 
			
		||||
	int name_size, fd, res;
 | 
			
		||||
| 
						 | 
				
			
			@ -4387,7 +4403,8 @@ static int make_local_socket(struct server *server, char *name)
 | 
			
		|||
 | 
			
		||||
	server->addr.sun_family = AF_LOCAL;
 | 
			
		||||
	name_size = snprintf(server->addr.sun_path, sizeof(server->addr.sun_path),
 | 
			
		||||
                             "%s/%s", runtime_dir, name) + 1;
 | 
			
		||||
                             "%s/%s-%s", runtime_dir, name,
 | 
			
		||||
			     get_server_name(impl->context)) + 1;
 | 
			
		||||
 | 
			
		||||
	if (name_size > (int) sizeof(server->addr.sun_path)) {
 | 
			
		||||
		pw_log_error(NAME" %p: %s/%s too long",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,7 +35,7 @@ extern "C" {
 | 
			
		|||
#define PW_PROTOCOL_PULSE_DEFAULT_PORT 4713
 | 
			
		||||
#define PW_PROTOCOL_PULSE_DEFAULT_SOCKET "native"
 | 
			
		||||
 | 
			
		||||
#define PW_PROTOCOL_PULSE_DEFAULT_SERVER "unix:native"
 | 
			
		||||
#define PW_PROTOCOL_PULSE_DEFAULT_SERVER "unix:"PW_PROTOCOL_PULSE_DEFAULT_SOCKET
 | 
			
		||||
 | 
			
		||||
#define PW_PROTOCOL_PULSE_USAGE	"[ server.address=(tcp:[<ip>:]<port>|unix:<path>)[,...] ] "		\
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue