mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	reserver: update from upstream git
This commit is contained in:
		
							parent
							
								
									8208214882
								
							
						
					
					
						commit
						c579cb56e9
					
				
					 1 changed files with 18 additions and 9 deletions
				
			
		| 
						 | 
					@ -38,6 +38,7 @@ struct rm_monitor {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	char *device_name;
 | 
						char *device_name;
 | 
				
			||||||
	char *service_name;
 | 
						char *service_name;
 | 
				
			||||||
 | 
						char *match;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	DBusConnection *connection;
 | 
						DBusConnection *connection;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -51,6 +52,13 @@ struct rm_monitor {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define SERVICE_PREFIX "org.freedesktop.ReserveDevice1."
 | 
					#define SERVICE_PREFIX "org.freedesktop.ReserveDevice1."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SERVICE_FILTER				\
 | 
				
			||||||
 | 
						"type='signal',"			\
 | 
				
			||||||
 | 
						"sender='" DBUS_SERVICE_DBUS "',"	\
 | 
				
			||||||
 | 
						"interface='" DBUS_INTERFACE_DBUS "',"	\
 | 
				
			||||||
 | 
						"member='NameOwnerChanged',"		\
 | 
				
			||||||
 | 
						"arg0='%s'"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static DBusHandlerResult filter_handler(
 | 
					static DBusHandlerResult filter_handler(
 | 
				
			||||||
	DBusConnection *c,
 | 
						DBusConnection *c,
 | 
				
			||||||
	DBusMessage *s,
 | 
						DBusMessage *s,
 | 
				
			||||||
| 
						 | 
					@ -175,11 +183,13 @@ int rm_watch(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	m->filtering = 1;
 | 
						m->filtering = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dbus_bus_add_match(m->connection,
 | 
						if (!(m->match = malloc(sizeof(SERVICE_FILTER) - 2 + strlen(m->service_name)))) {
 | 
				
			||||||
			   "type='signal',"
 | 
							r = -ENOMEM;
 | 
				
			||||||
			   "sender='" DBUS_SERVICE_DBUS "',"
 | 
							goto fail;
 | 
				
			||||||
			   "interface='" DBUS_INTERFACE_DBUS "',"
 | 
						}
 | 
				
			||||||
			   "member='NameOwnerChanged'", error);
 | 
					
 | 
				
			||||||
 | 
						sprintf(m->match, SERVICE_FILTER, m->service_name);
 | 
				
			||||||
 | 
						dbus_bus_add_match(m->connection, m->match, error);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (dbus_error_is_set(error)) {
 | 
						if (dbus_error_is_set(error)) {
 | 
				
			||||||
		r = -EIO;
 | 
							r = -EIO;
 | 
				
			||||||
| 
						 | 
					@ -220,10 +230,8 @@ void rm_release(rm_monitor *m) {
 | 
				
			||||||
	if (m->matching)
 | 
						if (m->matching)
 | 
				
			||||||
		dbus_bus_remove_match(
 | 
							dbus_bus_remove_match(
 | 
				
			||||||
			m->connection,
 | 
								m->connection,
 | 
				
			||||||
			"type='signal',"
 | 
								m->match,
 | 
				
			||||||
			"sender='" DBUS_SERVICE_DBUS "',"
 | 
								NULL);
 | 
				
			||||||
			"interface='" DBUS_INTERFACE_DBUS "',"
 | 
					 | 
				
			||||||
			"member='NameOwnerChanged'", NULL);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (m->filtering)
 | 
						if (m->filtering)
 | 
				
			||||||
		dbus_connection_remove_filter(
 | 
							dbus_connection_remove_filter(
 | 
				
			||||||
| 
						 | 
					@ -233,6 +241,7 @@ void rm_release(rm_monitor *m) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	free(m->device_name);
 | 
						free(m->device_name);
 | 
				
			||||||
	free(m->service_name);
 | 
						free(m->service_name);
 | 
				
			||||||
 | 
						free(m->match);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (m->connection)
 | 
						if (m->connection)
 | 
				
			||||||
		dbus_connection_unref(m->connection);
 | 
							dbus_connection_unref(m->connection);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue