mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	bluez5: maintain transport->device_list properly
If device != NULL, the transport must be in its transport_list.
This commit is contained in:
		
							parent
							
								
									f2630ed6fc
								
							
						
					
					
						commit
						dda65b95af
					
				
					 1 changed files with 13 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -2124,11 +2124,18 @@ static int transport_update_props(struct spa_bt_transport *transport,
 | 
			
		|||
				spa_bt_transport_set_state(transport, spa_bt_transport_state_from_string(value));
 | 
			
		||||
			}
 | 
			
		||||
			else if (spa_streq(key, "Device")) {
 | 
			
		||||
				transport->device = spa_bt_device_find(monitor, value);
 | 
			
		||||
				if (transport->device == NULL)
 | 
			
		||||
				struct spa_bt_device *device = spa_bt_device_find(monitor, value);
 | 
			
		||||
				if (transport->device != device) {
 | 
			
		||||
					if (transport->device != NULL)
 | 
			
		||||
						spa_list_remove(&transport->device_link);
 | 
			
		||||
					transport->device = device;
 | 
			
		||||
					if (device != NULL)
 | 
			
		||||
						spa_list_append(&device->transport_list, &transport->device_link);
 | 
			
		||||
					else
 | 
			
		||||
						spa_log_warn(monitor->log, "could not find device %s", value);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (spa_streq(key, "Codec")) {
 | 
			
		||||
			uint8_t value;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2907,7 +2914,6 @@ static DBusHandlerResult endpoint_set_configuration(DBusConnection *conn,
 | 
			
		|||
	DBusMessageIter it[2];
 | 
			
		||||
	DBusMessage *r;
 | 
			
		||||
	struct spa_bt_transport *transport;
 | 
			
		||||
	bool is_new = false;
 | 
			
		||||
	const struct a2dp_codec *codec;
 | 
			
		||||
	int profile;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2930,9 +2936,8 @@ static DBusHandlerResult endpoint_set_configuration(DBusConnection *conn,
 | 
			
		|||
	dbus_message_iter_recurse(&it[0], &it[1]);
 | 
			
		||||
 | 
			
		||||
	transport = spa_bt_transport_find(monitor, transport_path);
 | 
			
		||||
	is_new = transport == NULL;
 | 
			
		||||
 | 
			
		||||
	if (is_new) {
 | 
			
		||||
	if (transport == NULL) {
 | 
			
		||||
		char *tpath = strdup(transport_path);
 | 
			
		||||
 | 
			
		||||
		transport = spa_bt_transport_create(monitor, tpath, 0);
 | 
			
		||||
| 
						 | 
				
			
			@ -2965,10 +2970,6 @@ static DBusHandlerResult endpoint_set_configuration(DBusConnection *conn,
 | 
			
		|||
		spa_log_warn(monitor->log, "no device found for transport");
 | 
			
		||||
		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 | 
			
		||||
	}
 | 
			
		||||
	spa_bt_device_add_profile(transport->device, transport->profile);
 | 
			
		||||
 | 
			
		||||
	if (is_new)
 | 
			
		||||
		spa_list_append(&transport->device->transport_list, &transport->device_link);
 | 
			
		||||
 | 
			
		||||
	device_update_last_bluez_action_time(transport->device);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2999,6 +3000,8 @@ static DBusHandlerResult endpoint_set_configuration(DBusConnection *conn,
 | 
			
		|||
	spa_log_info(monitor->log, "%p: %s validate conf channels:%d",
 | 
			
		||||
			monitor, path, transport->n_channels);
 | 
			
		||||
 | 
			
		||||
	spa_bt_device_add_profile(transport->device, transport->profile);
 | 
			
		||||
 | 
			
		||||
	spa_bt_device_connect_profile(transport->device, transport->profile);
 | 
			
		||||
 | 
			
		||||
	/* Sync initial volumes */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue