mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	alsa-monitor: Don't ignore device reservation failure
We were ignoring the reservation status, which is incorrect as we might not have succeeded in grabbing the device.
This commit is contained in:
		
							parent
							
								
									2acfa0ee10
								
							
						
					
					
						commit
						272624fe83
					
				
					 1 changed files with 12 additions and 7 deletions
				
			
		| 
						 | 
					@ -159,8 +159,9 @@ static int node_acquire(void *data)
 | 
				
			||||||
	node->acquired = true;
 | 
						node->acquired = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (device && device->n_acquired++ == 0 && device->reserve)
 | 
						if (device && device->n_acquired++ == 0 && device->reserve)
 | 
				
			||||||
		rd_device_acquire(device->reserve);
 | 
							return rd_device_acquire(device->reserve);
 | 
				
			||||||
	return 0;
 | 
						else
 | 
				
			||||||
 | 
							return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int node_release(void *data)
 | 
					static int node_release(void *data)
 | 
				
			||||||
| 
						 | 
					@ -775,10 +776,6 @@ static struct device *alsa_create_device(struct impl *impl, uint32_t id,
 | 
				
			||||||
		goto clean_device;
 | 
							goto clean_device;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sm_object_add_listener(&device->sdevice->obj,
 | 
					 | 
				
			||||||
			&device->listener,
 | 
					 | 
				
			||||||
			&device_events, device);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (impl->conn &&
 | 
						if (impl->conn &&
 | 
				
			||||||
	    (card = spa_dict_lookup(info->props, SPA_KEY_API_ALSA_CARD)) != NULL) {
 | 
						    (card = spa_dict_lookup(info->props, SPA_KEY_API_ALSA_CARD)) != NULL) {
 | 
				
			||||||
		const char *reserve;
 | 
							const char *reserve;
 | 
				
			||||||
| 
						 | 
					@ -796,10 +793,18 @@ static struct device *alsa_create_device(struct impl *impl, uint32_t id,
 | 
				
			||||||
			rd_device_set_application_device_name(device->reserve,
 | 
								rd_device_set_application_device_name(device->reserve,
 | 
				
			||||||
				spa_dict_lookup(info->props, SPA_KEY_API_ALSA_PATH));
 | 
									spa_dict_lookup(info->props, SPA_KEY_API_ALSA_PATH));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			rd_device_acquire(device->reserve);
 | 
								if (rd_device_acquire(device->reserve) < 0) {
 | 
				
			||||||
 | 
									pw_log_warn("could not reserve device for %s: %m", reserve);
 | 
				
			||||||
 | 
									goto clean_device;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		device->priority -= atol(card) * 64;
 | 
							device->priority -= atol(card) * 64;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						sm_object_add_listener(&device->sdevice->obj,
 | 
				
			||||||
 | 
								&device->listener,
 | 
				
			||||||
 | 
								&device_events, device);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	device->pending_profile = 1;
 | 
						device->pending_profile = 1;
 | 
				
			||||||
	device->first = true;
 | 
						device->first = true;
 | 
				
			||||||
	spa_list_init(&device->node_list);
 | 
						spa_list_init(&device->node_list);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue