mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	media-session: bluez-autoswitch: simplify logic
When `val` was used, it was always a true-ish since the address of an array on the stack was assigned to it. Remove this variable altogether, and use `name` directly. Only use `name` when it is valid - when `key && value`.
This commit is contained in:
		
							parent
							
								
									3724088c21
								
							
						
					
					
						commit
						090aaa4fb0
					
				
					 1 changed files with 1 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -557,17 +557,14 @@ static int metadata_property(void *object, uint32_t subject,
 | 
			
		|||
{
 | 
			
		||||
	struct impl *impl = object;
 | 
			
		||||
	if (subject == PW_ID_CORE) {
 | 
			
		||||
		char *val = NULL;
 | 
			
		||||
		char name[1024];
 | 
			
		||||
 | 
			
		||||
		if (key && value && json_object_find(value, "name", name, sizeof(name)) < 0)
 | 
			
		||||
			return 0;
 | 
			
		||||
		else
 | 
			
		||||
			val = name;
 | 
			
		||||
 | 
			
		||||
		if (key == NULL || spa_streq(key, DEFAULT_AUDIO_SINK_KEY)) {
 | 
			
		||||
			free(impl->default_sink);
 | 
			
		||||
			impl->default_sink = (key && val) ? strdup(val) : NULL;
 | 
			
		||||
			impl->default_sink = (key && value) ? strdup(name) : NULL;
 | 
			
		||||
 | 
			
		||||
			/* Switch also when default output changes */
 | 
			
		||||
			switch_profile_if_needed(impl);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue