mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	a2dp-source: improve info parsing
Make sure we handle NULL info. Simplify the property parsing.
This commit is contained in:
		
							parent
							
								
									e7f2f450ff
								
							
						
					
					
						commit
						43317f67ba
					
				
					 1 changed files with 6 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -1309,8 +1309,12 @@ impl_init(const struct spa_handle_factory *factory,
 | 
			
		|||
	spa_list_init(&port->ready);
 | 
			
		||||
	spa_list_init(&port->free);
 | 
			
		||||
 | 
			
		||||
	if (info && (str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_TRANSPORT)))
 | 
			
		||||
	if (info != NULL) {
 | 
			
		||||
		if ((str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_TRANSPORT)) != NULL)
 | 
			
		||||
			sscanf(str, "pointer:%p", &this->transport);
 | 
			
		||||
		if ((str = spa_dict_lookup(info, "bluez5.a2dp-source-role")) != NULL)
 | 
			
		||||
			this->is_input = strcmp(str, "input") == 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (this->transport == NULL) {
 | 
			
		||||
		spa_log_error(this->log, "a transport is needed");
 | 
			
		||||
| 
						 | 
				
			
			@ -1325,13 +1329,6 @@ impl_init(const struct spa_handle_factory *factory,
 | 
			
		|||
		this->codec_props = this->codec->init_props(this->codec,
 | 
			
		||||
					this->transport->device->settings);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	const char *a2dp_source_role = spa_dict_lookup(info, "bluez5.a2dp-source-role");
 | 
			
		||||
	if (a2dp_source_role != NULL && !strcmp("input", a2dp_source_role))
 | 
			
		||||
		this->is_input = true;
 | 
			
		||||
	else
 | 
			
		||||
		this->is_input = false;
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue