mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	media-session: move libcamera+bluez5 device removal to object free callback
libcamera + bluez5 devices should be freed/unloaded via the sm_object free callback, similarly as in alsa and v4l2 monitors. This ensures they are run at session_shutdown.
This commit is contained in:
		
							parent
							
								
									5b8c7c405d
								
							
						
					
					
						commit
						8ba6e98320
					
				
					 2 changed files with 35 additions and 25 deletions
				
			
		| 
						 | 
				
			
			@ -300,6 +300,20 @@ static void device_destroy(void *data)
 | 
			
		|||
		libcamera_remove_node(device, node);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void device_free(void *data)
 | 
			
		||||
{
 | 
			
		||||
	struct device *dev = data;
 | 
			
		||||
	pw_log_debug("remove device %u", dev->id);
 | 
			
		||||
	spa_list_remove(&dev->link);
 | 
			
		||||
	if (dev->appeared)
 | 
			
		||||
		spa_hook_remove(&dev->device_listener);
 | 
			
		||||
	sm_object_discard(&dev->sdevice->obj);
 | 
			
		||||
	spa_hook_remove(&dev->listener);
 | 
			
		||||
	pw_unload_spa_handle(dev->handle);
 | 
			
		||||
	pw_properties_free(dev->props);
 | 
			
		||||
	free(dev);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void device_update(void *data)
 | 
			
		||||
{
 | 
			
		||||
	struct device *device = data;
 | 
			
		||||
| 
						 | 
				
			
			@ -323,6 +337,7 @@ static void device_update(void *data)
 | 
			
		|||
static const struct sm_object_events device_events = {
 | 
			
		||||
	SM_VERSION_OBJECT_EVENTS,
 | 
			
		||||
        .destroy = device_destroy,
 | 
			
		||||
        .free = device_free,
 | 
			
		||||
        .update = device_update,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -400,16 +415,7 @@ exit:
 | 
			
		|||
 | 
			
		||||
static void libcamera_remove_device(struct impl *impl, struct device *dev)
 | 
			
		||||
{
 | 
			
		||||
	pw_log_debug("remove device %u", dev->id);
 | 
			
		||||
	spa_list_remove(&dev->link);
 | 
			
		||||
	if (dev->appeared)
 | 
			
		||||
		spa_hook_remove(&dev->device_listener);
 | 
			
		||||
	if (dev->sdevice)
 | 
			
		||||
		sm_object_destroy(&dev->sdevice->obj);
 | 
			
		||||
	spa_hook_remove(&dev->listener);
 | 
			
		||||
	pw_unload_spa_handle(dev->handle);
 | 
			
		||||
	pw_properties_free(dev->props);
 | 
			
		||||
	free(dev);
 | 
			
		||||
	sm_object_destroy(&dev->sdevice->obj);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void libcamera_udev_object_info(void *data, uint32_t id,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue